2013-02-02 16:43:47 +01:00
|
|
|
class SupporterLevel < ActiveRecord::Base
|
|
|
|
|
belongs_to :conference
|
|
|
|
|
has_many :supporter_registrations
|
2014-05-23 21:21:11 +05:30
|
|
|
monetize :price_cents, with_model_currency: :price_currency
|
2014-05-23 21:38:40 +05:30
|
|
|
attr_accessible :conference, :title, :url, :description, :price_currency, :amount, :price_cents
|
2014-05-23 21:21:11 +05:30
|
|
|
validate :convert_money_to_cents
|
|
|
|
|
private
|
2014-05-23 21:38:40 +05:30
|
|
|
def convert_money_to_cents
|
|
|
|
|
self.price_cents = (self.amount.to_d * 100).to_i
|
|
|
|
|
end
|
2013-02-02 16:43:47 +01:00
|
|
|
end
|