Sha256: 53e2e509b651475cf4bc4f5254ed2178168fd160a1545e405955d4eacd272aea

Contents?: true

Size: 740 Bytes

Versions: 14

Compression:

Stored size: 740 Bytes

Contents

module CanTango
  module Api
    module UserAccount
      module Can
        include Ability
        # Example: generated from types of accounts! (see below)
        # def admin_account_can?(*args)
        #   current_account_ability(:admin).can?(*args)
        # end
        def self.included(base)
          ::CanTango.config.user_accounts.registered.each do |account|
            base.class_eval %{
              def #{account}_account_can? *args
                current_account_ability(:#{account}).can?(*args)
              end

              def #{account}_account_cannot? *args
                current_account_ability(:#{account}).cannot?(*args)
              end
             }
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cantango-0.8.9.5 lib/cantango/api/user_account/can.rb
cantango-0.8.9.4 lib/cantango/api/user_account/can.rb
cantango-0.8.9.3 lib/cantango/api/user_account/can.rb
cantango-0.8.9.2 lib/cantango/api/user_account/can.rb
cantango-0.8.9.1 lib/cantango/api/user_account/can.rb
cantango-0.8.9 lib/cantango/api/user_account/can.rb
cantango-0.8.8.1 lib/cantango/api/user_account/can.rb
cantango-0.8.8 lib/cantango/api/user_account/can.rb
cantango-0.8.7 lib/cantango/api/user_account/can.rb
cantango-0.8.6.2 lib/cantango/api/user_account/can.rb
cantango-0.8.6.1 lib/cantango/api/user_account/can.rb
cantango-0.8.6 lib/cantango/api/user_account/can.rb
cantango-0.8.5.1 lib/cantango/api/user_account/can.rb
cantango-0.8.0 lib/cantango/api/user_account/can.rb