summaryrefslogtreecommitdiffstats
path: root/app/models/enumeration.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-25 19:48:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-25 19:48:22 +0000
commit221585c7b5708659e9059b6119846948b07570bb (patch)
treebb864aff3c998c6e74b922d5dd78297ee2b3e404 /app/models/enumeration.rb
parente7b9a9c6ff43711faf5ef0f1c480b43c61636f8c (diff)
downloadredmine-221585c7b5708659e9059b6119846948b07570bb.tar.gz
redmine-221585c7b5708659e9059b6119846948b07570bb.zip
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9713 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/enumeration.rb')
-rw-r--r--app/models/enumeration.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb
index b72972218..d4564a036 100644
--- a/app/models/enumeration.rb
+++ b/app/models/enumeration.rb
@@ -35,19 +35,19 @@ class Enumeration < ActiveRecord::Base
validates_uniqueness_of :name, :scope => [:type, :project_id]
validates_length_of :name, :maximum => 30
- scope :shared, :conditions => { :project_id => nil }
- scope :active, :conditions => { :active => true }
- scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
+ scope :shared, where(:project_id => nil)
+ scope :active, where(:active => true)
+ scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
def self.default
# Creates a fake default scope so Enumeration.default will check
# it's type. STI subclasses will automatically add their own
# types to the finder.
if self.descends_from_active_record?
- find(:first, :conditions => { :is_default => true, :type => 'Enumeration' })
+ where(:is_default => true, :type => 'Enumeration').first
else
# STI classes are
- find(:first, :conditions => { :is_default => true })
+ where(:is_default => true).first
end
end
@@ -58,7 +58,7 @@ class Enumeration < ActiveRecord::Base
def check_default
if is_default? && is_default_changed?
- Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
+ Enumeration.update_all({:is_default => false}, {:type => type})
end
end