seeds.rb 2.7 KB

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