Skip to content

Adds a relation to models to a Account model and sets it on model initialization

License

Notifications You must be signed in to change notification settings

hiasinho/mongoid_accountify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoidAccountify

MongoidAccountify adds a relation to models to a Account model and sets it on model initialization.

Install

gem 'mongoid_accountify'

Usage

# Default config
Mongoid::Accountify.configure do |c|
  c.account_reader = :current_account
  c.account_model = :account
  c.account_relation = :account
end

# Example model
class Person
  include Mongoid::Document
  include Mongoid::Accountify
end

# Build instance
p = Person.new

# Account instance
p.account
# => <Account _id: 50470dce6f51b7c68e000009>

Credits

Copyright (c) 2012 Mathias Schneider http://www.codecrafts.de

About

Adds a relation to models to a Account model and sets it on model initialization

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages