Sha256: 01af7f5f03fce7a19dbbae48d387888b22058d2f83e9360069f9a7133625f2a1

Contents?: true

Size: 468 Bytes

Versions: 7

Compression:

Stored size: 468 Bytes

Contents

module Ems
  class Tag < ActiveRecord::Base
    extend FriendlyId
    friendly_id :title, use: :slugged

    has_and_belongs_to_many :articles, :join_table => 'ems_articles_tags'
    accepts_nested_attributes_for :articles


    validates_uniqueness_of :slug
    validates :slug, :presence => true
    validates :title, :presence => true
    
    #
    # @param options
    def as_json(options={})
      super(options.merge(:include => [:articles]))
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ems-0.0.8 app/models/ems/tag.rb
ems-0.0.7 app/models/ems/tag.rb
ems-0.0.6 app/models/ems/tag.rb
ems-0.0.5 app/models/ems/tag.rb
ems-0.0.4 app/models/ems/tag.rb
ems-0.0.3 app/models/ems/tag.rb
ems-0.0.2 app/models/ems/tag.rb