Sha256: 48aa0be7aef3a55f93abe805c9024f2f8bd2091079cdf60a9716ecaaf0103f62
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require "babosa" module C80NewsTz class Company < ActiveRecord::Base has_many :galleries, :dependent => :destroy accepts_nested_attributes_for :galleries, :reject_if => lambda { |attributes| !attributes.present? }, :allow_destroy => true has_one :adress, :dependent => :destroy accepts_nested_attributes_for :adress, :reject_if => lambda { |attributes| !attributes.present? }, :allow_destroy => true has_many :cphotos, :dependent => :destroy accepts_nested_attributes_for :cphotos, :reject_if => lambda { |attributes| !attributes.present? }, :allow_destroy => true has_and_belongs_to_many :facts, :join_table => 'c80_news_tz_companies_facts' has_and_belongs_to_many :notices, :join_table => 'c80_news_tz_companies_notices' extend FriendlyId friendly_id :title, use: :slugged def normalize_friendly_id(input) input.to_s.to_slug.normalize(transliterations: :russian).to_s end def slug_candidates [:title] + Array.new(6) { |index| [:title, index+2] } end def should_generate_new_friendly_id? slug.blank? # name_changed? || super end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
c80_news_tz-0.1.1.1 | app/models/c80_news_tz/company.rb |
c80_news_tz-0.1.1.0 | app/models/c80_news_tz/company.rb |