Sha256: f9d7173547cdc52295b4539ae61b2f16722f4722009e1b7e27d638e86b38301e

Contents?: true

Size: 527 Bytes

Versions: 9

Compression:

Stored size: 527 Bytes

Contents

module Roles::ActiveRecord
  module Strategy
    module Shared
      def set_role role
        update_attributes(role_attribute => new_role(role))
      end
      alias_method :set_roles, :set_role

      def get_role
        r = self.send(role_attribute)
      end
      alias_method :get_roles, :get_role

      def select_valid_roles *roles
        roles.flat_uniq.select{|role| valid_role? role }
        has_role_class? ? role_class.find_roles(roles).to_a.flat_uniq : roles.flat_uniq
      end           
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
roles_active_record-0.4.6.3 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.6.2 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.6.1 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.6 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.5 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.4 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.3 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.2 lib/roles_active_record/strategy/shared.rb
roles_active_record-0.4.1 lib/roles_active_record/strategy/shared.rb