Use lambda form in model scopes (#12499)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10949 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Baptiste Barth
2012-12-07 10:12:47 +00:00
parent 8201761e77
commit 4896d5c7e8
12 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -85,9 +85,9 @@ class Project < ActiveRecord::Base
before_destroy :delete_all_members
scope :has_module, lambda { |mod| { :conditions => ["#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s] } }
scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"}
scope :active, lambda { { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}" } }
scope :status, lambda {|arg| arg.blank? ? {} : {:conditions => {:status => arg.to_i}} }
scope :all_public, { :conditions => { :is_public => true } }
scope :all_public, lambda { { :conditions => { :is_public => true } } }
scope :visible, lambda {|*args| {:conditions => Project.visible_condition(args.shift || User.current, *args) }}
scope :allowed_to, lambda {|*args|
user = User.current