Module: Accounts::BelongsToAccount
- Defined in:
- lib/accounts/belongs_to_account.rb
Instance Attribute Summary collapse
-
#padma_account ⇒ Object
Returns the value of attribute padma_account.
Class Method Summary collapse
Instance Method Summary collapse
-
#account(options = {}) ⇒ PadmaAccount / PadmaAccountDecorator
Returns associated account.
- #account_tester_level ⇒ Object
Instance Attribute Details
#padma_account ⇒ Object
Returns the value of attribute padma_account.
13 14 15 |
# File 'lib/accounts/belongs_to_account.rb', line 13 def padma_account @padma_account end |
Class Method Details
.included(base) ⇒ Object
9 10 11 |
# File 'lib/accounts/belongs_to_account.rb', line 9 def self.included(base) base.send(:validate, :padma_account_setted_correctly) end |
Instance Method Details
#account(options = {}) ⇒ PadmaAccount / PadmaAccountDecorator
Returns associated account.
account is stored in instance variable padma_account. This allows for it to be setted in a Mass-Load.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/accounts/belongs_to_account.rb', line 23 def account(={}) if self.padma_account.nil? || [:force_service_call] self.padma_account = PadmaAccount.find_with_rails_cache(account_name) end ret = padma_account if [:decorated] && padma_account ret = PadmaAccountDecorator.decorate(padma_account) end ret end |
#account_tester_level ⇒ Object
34 35 36 |
# File 'lib/accounts/belongs_to_account.rb', line 34 def account_tester_level account.try :tester_level end |