Votex v0.2.0 Votex.Voter View Source

Defines a Voter Model

A Voter model will expose the required methods to enable voting functionality Typically be used by models like User, Team, Organization etc.

Example

defmodule User do  
  use Ecto.Schema 
  use Votex.Voter
  schema "users" do 
    field :name, :string 
    field :age, :integer, default:  20 
  end  
end

Link to this section Summary

Functions

Reserved for internal use

Check if a votable record has been voted by a voter

Link to this section Functions

Reserved for internal use

Link to this function voted_for?(voter, votable) View Source

Check if a votable record has been voted by a voter

Example

voted = user |> User.voted_for? post