diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2013-12-23 15:32:55 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2013-12-23 15:32:55 +0100 |
commit | a959ac78e251f862251358ee2cf441b66c829ded (patch) | |
tree | 70cc2d35dc9461bf4ebb10bc283f82f19be60579 /lib/tasks/dev_load_sample_data.rake | |
parent | 08da7a61bf78b6d2e1ca51815495e25f1c91ed86 (diff) | |
download | hmnoweb-a959ac78e251f862251358ee2cf441b66c829ded.tar.gz hmnoweb-a959ac78e251f862251358ee2cf441b66c829ded.tar.bz2 hmnoweb-a959ac78e251f862251358ee2cf441b66c829ded.zip |
Posts in sample data should belong to category.
Diffstat (limited to 'lib/tasks/dev_load_sample_data.rake')
-rw-r--r-- | lib/tasks/dev_load_sample_data.rake | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tasks/dev_load_sample_data.rake b/lib/tasks/dev_load_sample_data.rake index 230ce95..81084e6 100644 --- a/lib/tasks/dev_load_sample_data.rake +++ b/lib/tasks/dev_load_sample_data.rake @@ -18,11 +18,12 @@ namespace :dev do user = Refinery::User.find_by_username("sample user") cats.each do |cat| (1..5).each do |n| - p = Refinery::Blog::Post.create(:title => "#{cat.title} post #{n}", - :body => Lorem::Base.new(:paragraphs, 5).output, - :user_id => user.id, - :draft => false) + p = Refinery::Blog::Post.new(:title => "#{cat.title} post #{n}", + :body => Lorem::Base.new(:paragraphs, 5).output, + :user_id => user.id, + :draft => false) p.published_at = DateTime.now + p.categories << cat p.save end end |