Class: Virgo::Site
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Virgo::Site
- Defined in:
- app/models/virgo/site.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.instance ⇒ Object
9 10 11 12 13 |
# File 'app/models/virgo/site.rb', line 9 def self.instance _instance = first _instance || self.new end |
Instance Method Details
#generate_dummy_data!(opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/virgo/site.rb', line 15 def generate_dummy_data!(opts={}) if Post.all.empty? || opts[:force] == true require 'faker' I18n.reload! # see https://github.com/stympy/faker/issues/285 post = Post.new( headline: "Your First Post", subhead: Faker::Lorem.paragraph, author: User.order(id: :asc).first, body: Faker::Lorem.paragraphs(10).map{|p| "<p>#{p}</p>"}.join, status: :published, publish_at: Time.now, live: true ) post.save! end end |