@@ -192,7 +192,7 @@ def rated?
192192 end
193193
194194 # last is the one where we don't keep the statistics - go direct to the db
195- !ratings . find ( : first) . nil?
195+ !ratings . first . nil?
196196 end
197197
198198 # Get the number of ratings for this object based on the special fields,
@@ -225,7 +225,7 @@ def rate value, rater = nil
225225 raise RateError , "the rater object must be the one used when defining acts_as_rated (or a descendent of it). other objects are not acceptable"
226226 end
227227 raise RateError , "rating with rater must receive a rater as parameter" if with_rater && ( rater . nil? || rater . id . nil? )
228- r = with_rater ? ratings . find ( :first , : conditions => [ 'rater_id = ?' , rater . id ] ) : nil
228+ r = with_rater ? ratings . where ( : conditions => [ 'rater_id = ?' , rater . id ] ) . first : nil
229229 raise RateError , "value is out of range!" unless acts_as_rated_options [ :rating_range ] . nil? || acts_as_rated_options [ :rating_range ] === value
230230
231231 # Find the place to store the rating statistics if any...
@@ -273,7 +273,7 @@ def unrate rater
273273 end
274274 raise RateError , "Rater must be a valid and existing object" if rater . nil? || rater . id . nil?
275275 raise RateError , 'Cannot unrate if not using a rater' if !rating_class . column_names . include? "rater_id"
276- r = ratings . find ( :first , : conditions => [ 'rater_id = ?' , rater . id ] )
276+ r = ratings . where ( : conditions => [ 'rater_id = ?' , rater . id ] ) . first
277277 if !r . nil?
278278 target = self if attributes . has_key? 'rating_total'
279279 target ||= self . rating_statistic if acts_as_rated_options [ :stats_class ]
@@ -406,7 +406,7 @@ def find_rated_by rater
406406 raise RateError , "Rater must be an existing object with an id" if rater . id . nil?
407407 rated_class = ActiveRecord ::Base . send ( :class_name_of_active_record_descendant , self ) . to_s
408408 conds = [ 'rated_type = ? AND rater_id = ?' , rated_class , rater . id ]
409- acts_as_rated_options [ :rating_class ] . constantize . find ( :all , :conditions => conds ) . collect { |r | r . rated_type . constantize . find_by_id r . rated . id }
409+ acts_as_rated_options [ :rating_class ] . constantize . where ( :conditions => conds ) . collect { |r | r . rated_type . constantize . find_by_id r . rated . id }
410410 end
411411
412412
0 commit comments