lib/role_on.rb in darkhelmet-role_on-0.2.2 vs lib/role_on.rb in darkhelmet-role_on-0.2.3
- old
+ new
@@ -31,11 +31,16 @@
alias :has_roles? :has_role?
end
module RoleOnUserClassMethods
def helper_for(role,name = role.to_s.pluralize)
- named_scope(name, :conditions => ['role_id = ?', Role[role].id], :joins => :roles)
- named_scope("non_#{name}", :conditions => [ 'roles.id is ? or roles.id != ?', nil, Role[role].id ], :joins => :roles)
+ named_scope(name) do
+ { :conditions => ['role_id = ?', Role[role].id], :joins => :roles }
+ end
+
+ named_scope("non_#{name}") do
+ { :conditions => [ 'roles.id is ? or roles.id != ?', nil, Role[role].id ], :joins => :roles }
+ end
end
end
def self.included(klass)
if User == klass