Orbit/app/models/user/attribute.rb

29 lines
644 B
Ruby
Raw Permalink Normal View History

2011-12-23 10:34:21 +00:00
class Attribute
include Mongoid::Document
include Mongoid::Timestamps
field :key
field :built_in, :type => Boolean, :default => false
field :disabled, :type => Boolean, :default => false
2013-01-14 10:19:14 +00:00
field :title, localize: true
field :to_search, :type => Boolean, :default => false
2011-12-23 10:34:21 +00:00
2012-01-24 07:12:06 +00:00
has_many :attribute_fields, :autosave => true, :dependent => :destroy
2011-12-23 10:34:21 +00:00
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
2011-12-23 10:34:21 +00:00
def is_built_in?
self.built_in
end
def is_disabled?
self.disabled
end
def get_enabled_attribute_fields
self.attribute_fields.excludes('disabled' => true)
end
end