73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/horde/actions/rate.rb', line 73
def create_rate_associations
target_class_name = self.name assn_name = "rated_#{target_class_name.tableize}"
::Horde::Rate.belongs_to :rater,
:foreign_key => :actor_id,
:class_name => Horde::Setting.actor_class_name
::Horde::Rate.belongs_to assn_name.singularize.to_sym,
:foreign_key => :target_id,
:class_name => target_class_name
Horde::Setting.actor_class_name.constantize.instance_eval do
include ActorMethods
has_many assn_name,
:through => :created_rates,
:source => assn_name.singularize,
:conditions => {:"horde_rates.target_type" => target_class_name}
end
end
|