comparison app/models/.svn/text-base/enumeration.rb.svn-base @ 508:851510f1b535 cannam

Merge from branch "redmine-1.2"
author Chris Cannam
date Thu, 14 Jul 2011 10:37:36 +0100
parents 0c939c159af4
children
comparison
equal deleted inserted replaced
506:1551c61843d2 508:851510f1b535
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.