Sha256: 3f9bdbafba099f20a90a28917523ce469a1daf30f448417467e7addb259a9e96

Contents?: true

Size: 455 Bytes

Versions: 1

Compression:

Stored size: 455 Bytes

Contents

class Community < ActiveRecord::Base
  extend FriendlyId
  
  belongs_to :organization
  
  has_many :categories, class_name: 'CommunityCategory'
  has_many :feedbacks
  
  validates :organization_id, presence: true
  validates :name, presence: true, uniqueness: true
  
  friendly_id :name, use: :slugged
  
  attr_accessible :organization_id, :name, :text
  
  private
  
  def should_generate_new_friendly_id?
    slug.blank? || name_changed?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voluntary_feedback-0.1.0 app/models/community.rb