Skip to content

Voter type being incorrectly set for extended classes on up / down vote #10

Description

@jeffreyiacono

Let say we have User that inherits from ActiveRecord::Base and Admin that inherits from User. The User is a voter (make_voter). Creating an up / down vote for an instance of User works great. However, an up / down vote for an instance of Admin will incorrectly set the voter_type to "User". To compound issues, #up_voted? / #down_voted? check against a voter_type of "Admin" for Admin instances, so a voteable item that has been voted on will incorrectly report that you have not yet voted on the item in question. With this check failing, you could incorrectly display voting controls in your UI, which will raise an AlreadyVotedError if implemented against #up_vote / #down_vote.

Failing test: jeffreyiacono@2d4aa11

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions