This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/models/user/attribute_field.rb

38 lines
800 B
Ruby

class AttributeField
include Mongoid::Document
include Mongoid::Timestamps
field :key
field :markup
field :locale, :type => Boolean, :default => true
field :list_options, :type => Array
field :built_in, :type => Boolean, :default => false
field :disabled, :type => Boolean, :default => false
field :title, localize: true
belongs_to :attribute
has_many :attribute_values
# validates_uniqueness_of :key
# Convert the string list_options into an array
def select_list_options=(var)
self.list_options = var.gsub(' ', '').split(',')
end
# Convert the array list_options into a string
def select_list_options
self.list_options.to_a.join(', ')
end
def is_built_in?
self.built_in
end
def is_disabled?
self.disabled
end
end