validates_uniqueness_of :name, :scope => [:type, :project_id]
validates_length_of :name, :maximum => 30
- scope :shared, lambda { where(:project_id => nil) }
- scope :sorted, lambda { order(:position) }
- scope :active, lambda { where(:active => true) }
- scope :system, lambda { where(:project_id => nil) }
+ scope :shared, lambda {where(:project_id => nil)}
+ scope :sorted, lambda {order(:position)}
+ scope :active, lambda {where(:active => true)}
+ scope :system, lambda {where(:project_id => nil)}
scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
def self.default