Module: VoteableIsm::InstanceMethods

Defined in:
lib/voteable-ism.rb

Instance Method Summary collapse

Instance Method Details

#generate_slugObject



15
16
17
# File 'lib/voteable-ism.rb', line 15

def generate_slug
  self.slug = self.username.gsub(' ', '-')
end

#total_votesObject



11
12
13
# File 'lib/voteable-ism.rb', line 11

def total_votes
  self.votes.where(vote: true).size - self.votes.where(votes: false).size
end