lib/cantango/api/scope/account.rb in cantango-api-0.0.0 vs lib/cantango/api/scope/account.rb in cantango-api-0.1.0
- old
+ new
@@ -1,25 +1,28 @@
module CanTango::Api
module Scope
module Account
- def account_scope scope, options = {}, &block
+ include CanTango::Api::Ability::Account
+
+ def scope_account scope, options = {}, &block
account = scoped_account(scope)
- ab_scope = account_ability_scope(account, options)
+ ab_scope = account_ability_scope(account, options.merge(:masquerade => true))
yield ab_scope if block
ab_scope
end
+ alias_method :account_scope, :scope_account
- def as_real_account scope, options = {}, &block
+ def real_account scope, options = {}, &block
scope_account scope, options.merge(:masquerade => false), &block
end
protected
def account_ability_scope account, options = {}
- CanTango::Ability::Scope.new user_account_ability(account, options)
+ CanTango::Scope::Ability.new account_ability(account, options)
end
- def scoped_acount scope
+ def scoped_account scope
send(:"current_#{scope}_account")
end
end
end
end