aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/tasks/dev_load_sample_data.rake9
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