bigdir/app/models/relative_memo_to_open_sourc...

15 lines
501 B
Ruby
Raw Permalink Normal View History

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