This commit is contained in:
alterpub 2014-08-31 00:28:28 +04:00
parent 5485fe0e7f
commit 36097f6b8b
4 changed files with 13 additions and 3 deletions

View file

@ -5,5 +5,9 @@ class Commercial < ActiveRecord::Base
validates :commercial_id, :commercial_type, presence: true
validates :commercial_type, inclusion: { in: CONFIG['commercial_types'].values }, allow_blank: true
validates :commercial_type, inclusion: { in: :get_types_enum }, allow_blank: true
def get_types_enum
CONFIG['commercial_types'].nil? ? nil : CONFIG['commercial_types'].values
end
end