class Ghost::Seeder::Models::PostsSeed

Public Class Methods

klass() click to toggle source
# File lib/ghost/seeder/models/posts_seed.rb, line 8
def self.klass
  Post
end

Private Instance Methods

attributes_for_create() click to toggle source
# File lib/ghost/seeder/models/posts_seed.rb, line 14
def attributes_for_create
  defaults.merge(attributes).merge(
    author_id: first_user.id,
    created_by: first_user.id,
    updated_by: first_user.id,
    published_by: first_user.id,
    html: redcarpet.render(record.markdown)
  )
end
defaults() click to toggle source
# File lib/ghost/seeder/models/posts_seed.rb, line 24
def defaults
  {
    created_at: Time.now,
    updated_at: Time.now,
    published_at: Time.now,
    page: false,
    featured: false,
    language: "en_US",
    status: "published",
    uuid: yaml_bindings_helper(:uuid)
  }
end
redcarpet() click to toggle source
# File lib/ghost/seeder/models/posts_seed.rb, line 37
def redcarpet
  Redcarpet::Markdown.new(
    Redcarpet::Render::HTML.new(hard_wrap: true)
  )
end