赞踩关联关系
This commit is contained in:
parent
4de9f959ac
commit
0791c35df1
|
@ -29,6 +29,7 @@ class Bid < ActiveRecord::Base
|
||||||
has_many :courses, :through => :homework_for_courses, :source => :project
|
has_many :courses, :through => :homework_for_courses, :source => :project
|
||||||
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
||||||
has_many :join_in_contests, :dependent => :destroy
|
has_many :join_in_contests, :dependent => :destroy
|
||||||
|
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||||
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Contest < ActiveRecord::Base
|
||||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||||
has_many :join_in_competitions, foreign_key: 'competition_id', :dependent => :destroy
|
has_many :join_in_competitions, foreign_key: 'competition_id', :dependent => :destroy
|
||||||
has_many :join_in_contests, class_name: 'JoinInCompetition', foreign_key: 'competition_id', :dependent => :destroy
|
has_many :join_in_contests, class_name: 'JoinInCompetition', foreign_key: 'competition_id', :dependent => :destroy
|
||||||
|
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ class Issue < ActiveRecord::Base
|
||||||
|
|
||||||
# added by fq
|
# added by fq
|
||||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||||
# end
|
# end
|
||||||
|
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||||
|
|
||||||
|
|
||||||
acts_as_nested_set :scope => 'root_id', :dependent => :destroy
|
acts_as_nested_set :scope => 'root_id', :dependent => :destroy
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class PraiseTread < ActiveRecord::Base
|
class PraiseTread < ActiveRecord::Base
|
||||||
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
|
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :praise_tread_object, polymorphic: true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue