Sha256: 1e9c15037fedff19cc7b9f734b5fd4a3e984c2212e3b5efa9a986bd6ed89a334

Contents?: true

Size: 434 Bytes

Versions: 1

Compression:

Stored size: 434 Bytes

Contents

class Brainstorming < ActiveRecord::Base
  extend FriendlyId
  
  belongs_to :user
  
  has_many :ideas, class_name: 'BrainstormingIdea', dependent: :destroy
  
  friendly_id :name, use: :scoped, scope: :user
  
  attr_accessible :name, :text
  
  validates :user_id, presence: true
  validates :name, presence: true, uniqueness: { scope: :user_id }
  
  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_brainstorming-0.0.2 app/models/brainstorming.rb