Sha256: f17d05832e0d6edd29befcbb8a2f709c7ba5775b019ce18e45de49445454741e

Contents?: true

Size: 315 Bytes

Versions: 4

Compression:

Stored size: 315 Bytes

Contents

class Tag < ActiveRecord::Base
  attr_accessible :name
  validates_presence_of :name
  
  has_many :taggings
  has_many :posts, :through => :taggings, :source_type => "Post", :source => :taggable
  
  autocomplete :name
  
  private
  
  def format_label_for_autocomplete
    "#{name}: #{taggings.count}"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
activeadmin_associations-0.1.3 spec/dummy/app/models/tag.rb
aa_associations-0.1.2 test/dummy/app/models/tag.rb
aa_associations-0.1.1 test/dummy/app/models/tag.rb
aa_associations-0.1.0 test/dummy/app/models/tag.rb