lib/role_on.rb in darkhelmet-role_on-0.1.3 vs lib/role_on.rb in darkhelmet-role_on-0.1.4

- old
+ new

@@ -30,9 +30,13 @@ module RoleOnUserClassMethods def helper_for(role,name = role.to_s.pluralize) (class << self; self; end).class_eval do define_method("all_#{name}") do + User.find(:all, :conditions => ['role_id = ?', Role[role].id], :joins => :roles) + end + + define_method("all_non_#{name}") do User.find(:all, :conditions => [ 'roles.id is ? or roles.id != ?', nil, Role[role].id ], :include => :roles) end end end end