jasherai / acts-as-rated

git svn clone of acts-as-rated
http://acts-as-rated.rubyforge.org
MIT License
56 stars 19 forks source link

find_rated_by(user) returns error in Rails 3 #3

Open ReggieBeans opened 13 years ago

ReggieBeans commented 13 years ago

I'm getting the following error:

irb(main):009:0> Article.find_rated_by(User.first)
   NoMethodError: undefined method `class_name_of_active_record_descendant' for ActiveRecord::Base:Class
    from C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/base.rb:1016:in `method_missing'
    from C:/Users/rob/web/insite-rails-cms/vendor/plugins/jasherai-acts-as-rated/lib/acts_as_rated.rb:376:in `send'
    from C:/Users/rob/web/insite-rails-cms/vendor/plugins/jasherai-acts-as-rated/lib/acts_as_rated.rb:376:in `find_rated_by'
    from (irb):9

I can fix the error by changing line 376 in acts_as_rated.rb from:

rated_class = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s

to:

rated_class = ActiveRecord::Base.send(:class_of_active_record_descendant, self).to_s