Plugin for Mongomatic to allow dot-notation access to document attributes
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
README.txt
matic_accessor.gemspec

README.txt

Mongomatic::Plugins::Accessors

  matic_accessor is a plugin for Mongomatic so you can use dot-notation to access the documents
  attributes

Usage

  require 'matic_accessor'

  class Monkey < Mongomatic::Base
    include Mongomatic::Plugins::Accessors
    matic_accessor :name, :nickname
    matic_reader   :age
    matic_writer   :weight
  end

  m = Monkey.new
  m.name      = 'funny'
  m.nickname  = 'bob'
  m[:age]     = 13
  m.weight    = 100
  m.insert

  m = Monkey.find_one
  m.name      # funny
  m.nickname  # bob
  m.age       # 13
  m[:weight]  # 100