Sha256: dcd9fc84744f6036c76c97c001386aba696e7f85feca650f5e4a5ea4707e54de

Contents?: true

Size: 660 Bytes

Versions: 6

Compression:

Stored size: 660 Bytes

Contents

class Area < ActiveRecord::Base
  include Applicat::Mvc::Model::Resource::Base
  include Applicat::Mvc::Model::Tree
  include Applicat::Mvc::Model::Tokenable
  
  has_and_belongs_to_many :users
  has_and_belongs_to_many :projects
  
  validates :name, presence: true, uniqueness: true
  
  attr_accessible :name, :parent_id
  
  extend FriendlyId
  
  friendly_id :name, :use => :slugged
  
  def self.find_by_product_id(product_id)
    roots.joins(:projects).merge(Project.for_product_id(product_id))
  end
  
  def children_for_product_id(product_id)
    children.joins(:projects).merge(Project.for_product_id(product_id))
  end
    
  def products
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voluntary-0.2.4 app/models/area.rb
voluntary-0.2.3 app/models/area.rb
voluntary-0.2.2 app/models/area.rb
voluntary-0.2.1 app/models/area.rb
voluntary-0.2.0 app/models/area.rb
voluntary-0.1.0 app/models/area.rb