collab/app/models/project.rb

13 lines
453 B
Ruby
Raw Normal View History

2010-03-04 06:22:45 +00:00
class Project < ActiveRecord::Base
has_many :tasks
2010-03-15 15:47:32 +00:00
has_many :wall_posts, :class_name => "Wall", :foreign_key => "project_id", :order => "created_at DESC"
2010-03-05 06:48:00 +00:00
belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
2010-03-04 06:22:45 +00:00
validates_presence_of :name
2010-03-05 06:48:00 +00:00
has_and_belongs_to_many :users
validates_uniqueness_of :name
named_scope :archived, :conditions => {:archived => true}
named_scope :active, :conditions => {:archived => false}
2010-03-04 06:22:45 +00:00
end