class Tag

Public Instance Methods

==(other) click to toggle source
# File lib/ecrire/app/models/tag.rb, line 39
def ==(other)
  self.class.table_name == other.class.table_name && self.id == other.id
end
posts() click to toggle source
# File lib/ecrire/app/models/tag.rb, line 43
def posts
  post_scope = ->(tag) { where '? = ANY (posts.tags)', tag.id }
  options = {}
  reflection = ActiveRecord::Reflection::HasManyReflection.new(:posts, post_scope, options, self.class)
  association = PostsAssociation.new(self, reflection)
  @posts ||= ActiveRecord::Associations::CollectionProxy.new(Post, association)
end