Sha256: 7875d93be5d62d928e2a518bc858097d10445b5d1e5dc1b7f3c127f31b2d594a

Contents?: true

Size: 379 Bytes

Versions: 8

Compression:

Stored size: 379 Bytes

Contents

class SettingsObject
  include Mongoid::Document
  include Mongoid::Timestamps
  include Ants::Id
  include Ants::Slug

  ## Attributes
  field :title
  field :values, type: Hash, default: {}

  ## Slug
  slug :title

  def values_attributes= (hash)
    values = hash
  end

  ## Class
  def self.hash
    all.to_a.inject({}) { |h, s| h[s.title.to_sym] = s.values; h }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ants-0.3.14 app/models/settings_object.rb
ants-0.3.13 app/models/settings_object.rb
ants-0.3.12 app/models/settings_object.rb
ants-0.3.11 app/models/settings_object.rb
ants-0.3.10 app/models/settings_object.rb
ants-0.3.9 app/models/settings_object.rb
ants-0.3.5 app/models/settings_object.rb
ants-0.3.4 app/models/settings_object.rb