oneclickorgs/one-click-orgs

View on GitHub
app/models/vote.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Vote < ActiveRecord::Base
  attr_accessible :member, :proposal, :for
  
  belongs_to :member
  belongs_to :proposal
  
  def for_or_against
    Vote.for_or_against(self.for?)
  end
  
  def self.for_or_against(foa)
    foa ? "Support" : "Oppose"
  end
  
  def to_event
    {:timestamp => self.created_at, :object => self, :kind => :vote }
  end
end