From 562d3aa6a64724b66cdb163e16c553894cf515ba Mon Sep 17 00:00:00 2001 From: Nicolas Chuche Date: Mon, 8 Sep 2008 13:09:54 +0000 Subject: [PATCH] add builtin named_scope git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1792 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/role.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/role.rb b/app/models/role.rb index 6d2f643fd..5ff9470f9 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -19,6 +19,11 @@ class Role < ActiveRecord::Base # Built-in roles BUILTIN_NON_MEMBER = 1 BUILTIN_ANONYMOUS = 2 + + named_scope :builtin, lambda { |*args| + compare = 'not' if args.first == true + { :conditions => "#{compare} builtin = 0" } + } before_destroy :check_deletable has_many :workflows, :dependent => :delete_all do