diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/dev_load_sample_data.rake | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/tasks/dev_load_sample_data.rake b/lib/tasks/dev_load_sample_data.rake index 81084e6..c9333b9 100644 --- a/lib/tasks/dev_load_sample_data.rake +++ b/lib/tasks/dev_load_sample_data.rake @@ -9,17 +9,22 @@ namespace :dev do task :create_blog_categories => [:environment] do cats = %w{ Nyheter Intervjuer Anmeldelser Artikler } cats.each do |cat| - Refinery::Blog::Category.create(:title => cat) + pos = 0 + pos = 1 if cat == "Nyheter" + pos = 2 if cat == "Anmeldelser" + Refinery::Blog::Category.create(:title => cat, :sidebar_position => pos) end end task :create_blog_posts => [:environment, :create_blog_categories, :create_sample_user] do + include ActionView::Helpers + cats = Refinery::Blog::Category.all user = Refinery::User.find_by_username("sample user") cats.each do |cat| (1..5).each do |n| p = Refinery::Blog::Post.new(:title => "#{cat.title} post #{n}", - :body => Lorem::Base.new(:paragraphs, 5).output, + :body => simple_format(Lorem::Base.new(:paragraphs, 5).output), :user_id => user.id, :draft => false) p.published_at = DateTime.now |