seeds.rb 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #---
  2. # Excerpted from "Agile Web Development with Rails",
  3. # published by The Pragmatic Bookshelf.
  4. # Copyrights apply to this code. It may not be used to create training material,
  5. # courses, books, articles, and the like. Contact us if you are in doubt.
  6. # We make no guarantees that this code is fit for any purpose.
  7. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  8. #---
  9. #---
  10. # Excerpted from "Agile Web Development with Rails, 4rd Ed.",
  11. # published by The Pragmatic Bookshelf.
  12. # Copyrights apply to this code. It may not be used to create training material,
  13. # courses, books, articles, and the like. Contact us if you are in doubt.
  14. # We make no guarantees that this code is fit for any purpose.
  15. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  16. #---
  17. Product.delete_all
  18. Product.create(:title => 'Pragmatic Project Automation',
  19. :description =>
  20. %{<p>
  21. <em>Pragmatic Project Automation</em> shows you how to improve the
  22. consistency and repeatability of your project's procedures using
  23. automation to reduce risk and errors.
  24. </p>
  25. <p>
  26. Simply put, we're going to put this thing called a computer to work
  27. for you doing the mundane (but important) project stuff. That means
  28. you'll have more time and energy to do the really
  29. exciting---and difficult---stuff, like writing quality code.
  30. </p>},
  31. :image_url => '/images/auto.jpg',
  32. :price => 29.95)
  33. Product.create(:title => 'Pragmatic Version Control',
  34. :description =>
  35. %{<p>
  36. This book is a recipe-based approach to using Subversion that will
  37. get you up and running quickly---and correctly. All projects need
  38. version control: it's a foundational piece of any project's
  39. infrastructure. Yet half of all project teams in the U.S. don't use
  40. any version control at all. Many others don't use it well, and end
  41. up experiencing time-consuming problems.
  42. </p>},
  43. :image_url => '/images/svn.jpg',
  44. :price => 28.50)
  45. # . . .
  46. Product.create(:title => 'Pragmatic Unit Testing (C#)',
  47. :description =>
  48. %{<p>
  49. Pragmatic programmers use feedback to drive their development and
  50. personal processes. The most valuable feedback you can get while
  51. coding comes from unit testing.
  52. </p>
  53. <p>
  54. Without good tests in place, coding can become a frustrating game of
  55. "whack-a-mole." That's the carnival game where the player strikes at a
  56. mechanical mole; it retreats and another mole pops up on the opposite side
  57. of the field. The moles pop up and down so fast that you end up flailing
  58. your mallet helplessly as the moles continue to pop up where you least
  59. expect them.
  60. </p>},
  61. :image_url => '/images/utc.jpg',
  62. :price => 27.75)
  63. # This file should contain all the record creation needed to seed the database with its default values.
  64. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  65. #
  66. # Examples:
  67. #
  68. # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
  69. # Mayor.create(:name => 'Daley', :city => cities.first)