1
0
Fork 0
forked from OpenNeo/impress
impress/app/models/campaign.rb
2014-09-11 17:40:37 -05:00

14 lines
302 B
Ruby

class Campaign < ActiveRecord::Base
attr_accessible :active, :goal, :progress
has_many :donations
def progress_percent
(progress.to_f / goal) * 100
end
def self.current
self.where(active: true).first or
raise ActiveRecord::RecordNotFound.new("no current campaign")
end
end