Sha256: d6e7d88cd74bda70a156af251d7759164cda9a702ed5470be926dbf45136e9be
Contents?: true
Size: 679 Bytes
Versions: 5
Compression:
Stored size: 679 Bytes
Contents
module Roles::DataMapper module Strategy module Shared def set_role role vr = new_role(role) self.send("#{role_attribute}=", vr) # update_attributes(role_attribute => vr) end alias_method :set_roles, :set_role def get_role r = self.send(role_attribute) # respond_to?(:present_role) ? present_role(r) : r end def get_roles r = self.send(role_attribute) end 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
5 entries across 5 versions & 1 rubygems