impress/app/models/campaign.rb
Matchu abf08bb7e7 Delete attr_accessible from Campaign
idk what these were even doing here, I never built a UI to edit campaigns?
2023-07-29 10:18:42 -07:00

20 lines
355 B
Ruby

class Campaign < ActiveRecord::Base
has_many :donations
def progress_percent
[(progress.to_f / goal) * 100, 100].min
end
def remaining
goal - progress
end
def complete?
progress >= goal
end
def self.current
self.where(active: true).first or
raise ActiveRecord::RecordNotFound.new("no current campaign")
end
end