brettshollenberger/movie_reviews — pull request #6 by brettshollenberger (2013-06-18 21:25:20+00:00)
Title: Add Polymorphic Likes

Movies and reviews are now likable, as would be any singly-nested parent-child relationship. Likability would be broken if we double-nested, though that would be poor practice anyway.

This commit would add specs for liking both movies and reviews, and for unliking them once a user has liked them. Likes are scoped to likable things, so users can only like the same thing once, and then are presented with an unlike button.

This commit also adds a view helper called user_likes?, which accepts an Active Record object as an argument, e.g. user_likes? @movie or user_likes? review (assuming @reviews is being iterated over).