Sha256: 711a41cb70dd4dbd6e71165b0f013bdba65a0bca807b5bada1ad39e758239aea
Contents?: true
Size: 728 Bytes
Versions: 6
Compression:
Stored size: 728 Bytes
Contents
module Ems class Category < ActiveRecord::Base attr_accessible :name, :strapline # use friendly_id to handle our slugs extend FriendlyId friendly_id :name, use: :slugged def should_generate_new_friendly_id? new_record? end # Validators validates_uniqueness_of :slug validates :slug, :presence => true validates :name, :presence => true validates :strapline, :presence => true # relations has_and_belongs_to_many :channels, :join_table => 'ems_categories_channels' accepts_nested_attributes_for :channels has_many :articles # # @param options def as_json(options={}) super( options.merge( :include => [ :channels ] ) ) end end end
Version data entries
6 entries across 6 versions & 1 rubygems