Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-06-09 16:03:20 +03:00
commit ac886fb4cb
8 changed files with 64 additions and 52 deletions

View file

@ -3,9 +3,11 @@ class Pricelist < ActiveRecord::Base
monetize :price_cents
validates :price_cents, :price_currency, :valid_from, :category, presence: true
validates :price_cents, :price_currency, :price,
:valid_from, :category, :operation_category, :duration, presence: true
CATEGORIES = %w(ee com.ee fie.ee pri.ee med.ee)
CATEGORIES = %w(ee pri.ee fie.ee med.ee com.ee)
OPERATION_CATEGORIES = %w(new renew)
DURATIONS = %w(1year 2years 3years)
after_initialize :init_values
@ -13,4 +15,8 @@ class Pricelist < ActiveRecord::Base
return unless new_record?
self.valid_from = Time.zone.now.beginning_of_year
end
def name
"#{operation_category} #{category}"
end
end