comparison app/models/version.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 8661b858af72
children cbb26bc654de
comparison
equal deleted inserted replaced
441:cbce1fd3b1b7 507:0c939c159af4
31 validates_length_of :name, :maximum => 60 31 validates_length_of :name, :maximum => 60
32 validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true 32 validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true
33 validates_inclusion_of :status, :in => VERSION_STATUSES 33 validates_inclusion_of :status, :in => VERSION_STATUSES
34 validates_inclusion_of :sharing, :in => VERSION_SHARINGS 34 validates_inclusion_of :sharing, :in => VERSION_SHARINGS
35 35
36 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
36 named_scope :open, :conditions => {:status => 'open'} 37 named_scope :open, :conditions => {:status => 'open'}
37 named_scope :visible, lambda {|*args| { :include => :project, 38 named_scope :visible, lambda {|*args| { :include => :project,
38 :conditions => Project.allowed_to_condition(args.first || User.current, :view_issues) } } 39 :conditions => Project.allowed_to_condition(args.first || User.current, :view_issues) } }
39 40
40 # Returns true if +user+ or current user is allowed to view the version 41 # Returns true if +user+ or current user is allowed to view the version