class Ghost::Seeder::Models::PostTagsSeed

Public Class Methods

klass() click to toggle source
# File lib/ghost/seeder/models/post_tags_seed.rb, line 7
def self.klass
  PostTag
end
seeds() click to toggle source
# File lib/ghost/seeder/models/post_tags_seed.rb, line 11
def self.seeds
  load_fixtures("posts_tags").map do |post_tag|
    tag = Tag.find_by! slug: post_tag["tag_slug"]
    post = Post.find_by! slug: post_tag["post_slug"]
    {
      tag_id: tag.id,
      post_id: post.id
    }
  end
end

Private Instance Methods

attributes_for_create() click to toggle source
# File lib/ghost/seeder/models/post_tags_seed.rb, line 32
def attributes_for_create
  attributes
end
record_exists?() click to toggle source
# File lib/ghost/seeder/models/post_tags_seed.rb, line 24
def record_exists?
  self.class.klass.where(attributes).exists?
end
record_slug() click to toggle source
# File lib/ghost/seeder/models/post_tags_seed.rb, line 28
def record_slug
  return "[tag:#{record.tag_id} <-> post:#{record.post_id}]"
end