socialforge/app/models/relative_memo_to_open_sourc...

15 lines
501 B
Ruby

class RelativeMemoToOpenSourceProject < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :open_source_project, :foreign_key => "osp_id"
belongs_to :topic, :class_name => 'RelativeMemo', :foreign_key => 'relative_memo_id'
has_many :no_uses, :as => :no_use, :dependent => :delete_all
validates_presence_of :osp_id, :relative_memo_id
scope :no_use_for, lambda { |user_id|
{:include => :no_uses,
:conditions => ["#{NoUse.table_name}.user_id = ?", user_id] }
}
end