Sha256: 6fc2e0d74c24d0ece45ee9635a92613c483bab22daf5022e9991e8ad5fef2520
Contents?: true
Size: 688 Bytes
Versions: 8
Compression:
Stored size: 688 Bytes
Contents
module Ems class Category < ActiveRecord::Base # 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
8 entries across 8 versions & 1 rubygems