Added operation to pricelist #2380

This commit is contained in:
Priit Tark 2015-06-09 15:39:12 +03:00
parent ee150e73ec
commit 44157ea805
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