rename Option to OptionDefinition to be full Rails compliant
This commit is contained in:
27
app/models/merged/option_definition.rb
Normal file
27
app/models/merged/option_definition.rb
Normal file
@ -0,0 +1,27 @@
|
||||
module Merged
|
||||
class OptionDefinition < ActiveYaml::Base
|
||||
set_root_path Engine.root + "config"
|
||||
|
||||
fields :name , :default , :description , :values , :type
|
||||
|
||||
def type
|
||||
return attributes[:type] unless attributes[:type].blank?
|
||||
if has_values?
|
||||
"select"
|
||||
else
|
||||
"text"
|
||||
end
|
||||
end
|
||||
|
||||
def has_values?
|
||||
return false if attributes[:values].nil?
|
||||
! attributes[:values].empty?
|
||||
end
|
||||
|
||||
def values
|
||||
return [] unless has_values?
|
||||
attributes[:values].split(" ")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user