Mercurial > hg > soundsoftware-site
comparison app/models/enumeration.rb @ 507:0c939c159af4 redmine-1.2
Update to Redmine 1.2.1 on 1.2-stable branch (Redmine SVN rev 6270)
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:32:19 +0100 |
parents | 513646585e45 |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
441:cbce1fd3b1b7 | 507:0c939c159af4 |
---|---|
30 validates_uniqueness_of :name, :scope => [:type, :project_id] | 30 validates_uniqueness_of :name, :scope => [:type, :project_id] |
31 validates_length_of :name, :maximum => 30 | 31 validates_length_of :name, :maximum => 30 |
32 | 32 |
33 named_scope :shared, :conditions => { :project_id => nil } | 33 named_scope :shared, :conditions => { :project_id => nil } |
34 named_scope :active, :conditions => { :active => true } | 34 named_scope :active, :conditions => { :active => true } |
35 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}} | |
35 | 36 |
36 def self.default | 37 def self.default |
37 # Creates a fake default scope so Enumeration.default will check | 38 # Creates a fake default scope so Enumeration.default will check |
38 # it's type. STI subclasses will automatically add their own | 39 # it's type. STI subclasses will automatically add their own |
39 # types to the finder. | 40 # types to the finder. |