davidcelis/recommendable — pull request #23 by romaind (2012-04-14 13:57:29+00:00)
Title: Missing .to_s.classify in where() in some methods

Hi there,

I'm not very familiar with pull requests so please tell me if I'm not doing it well.

Before my change, user.liked always returned [] on my project using PG because it did the following request :
SELECT "recommendable_likes".* FROM "recommendable_likes" WHERE "recommendable_likes"."user_id" = 5 AND "recommendable_likes"."likeable_type" = '--- !ruby/class ''Item''

You can see the likeable_type is not correct here.
Had to change likes.where(:likeable_type => klass) to likes.where(:likeable_type => klass.to_s.classify) in liked_for, disliked_for, etc.

Tests are still passing, and didn't do any new tests cause I don't really now how to test that, seems like the problem does not occur with sqlite3.

Thanks for the awesome gem.
Regards,