Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@19478 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/4.2.0
has_many :users | has_many :users | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name | |||||
validates_uniqueness_of :name, :case_sensitive => false | |||||
validates_length_of :name, :maximum => 60 | validates_length_of :name, :maximum => 60 | ||||
safe_attributes( | safe_attributes( |
:scope => preload(:user, {:repository => :project}) | :scope => preload(:user, {:repository => :project}) | ||||
validates_presence_of :repository_id, :revision, :committed_on, :commit_date | validates_presence_of :repository_id, :revision, :committed_on, :commit_date | ||||
validates_uniqueness_of :revision, :scope => :repository_id | |||||
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true | |||||
validates_uniqueness_of :revision, :scope => :repository_id, :case_sensitive => false | |||||
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true, :case_sensitive => false | |||||
scope :visible, lambda {|*args| | scope :visible, lambda {|*args| | ||||
joins(:repository => :project). | joins(:repository => :project). |
store :format_store | store :format_store | ||||
validates_presence_of :name, :field_format | validates_presence_of :name, :field_format | ||||
validates_uniqueness_of :name, :scope => :type | |||||
validates_uniqueness_of :name, :scope => :type, :case_sensitive => false | |||||
validates_length_of :name, :maximum => 30 | validates_length_of :name, :maximum => 30 | ||||
validates_length_of :regexp, maximum: 255 | validates_length_of :regexp, maximum: 255 | ||||
validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats } | validates_inclusion_of :field_format, :in => Proc.new { Redmine::FieldFormat.available_formats } |
acts_as_watchable | acts_as_watchable | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name, :scope => :project_id | |||||
validates_uniqueness_of :name, :scope => :project_id, :case_sensitive => false | |||||
after_create :module_enabled | after_create :module_enabled | ||||
before_save :check_default | before_save :check_default | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name, :scope => [:type, :project_id] | |||||
validates_uniqueness_of :name, :scope => [:type, :project_id], :case_sensitive => false | |||||
validates_length_of :name, :maximum => 30 | validates_length_of :name, :maximum => 30 | ||||
scope :shared, lambda { where(:project_id => nil) } | scope :shared, lambda { where(:project_id => nil) } |
has_many :issues, :foreign_key => 'category_id', :dependent => :nullify | has_many :issues, :foreign_key => 'category_id', :dependent => :nullify | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name, :scope => [:project_id] | |||||
validates_uniqueness_of :name, :scope => [:project_id], :case_sensitive => false | |||||
validates_length_of :name, :maximum => 60 | validates_length_of :name, :maximum => 60 | ||||
safe_attributes 'name', 'assigned_to_id' | safe_attributes 'name', 'assigned_to_id' |
validates_presence_of :issue_from, :issue_to, :relation_type | validates_presence_of :issue_from, :issue_to, :relation_type | ||||
validates_inclusion_of :relation_type, :in => TYPES.keys | validates_inclusion_of :relation_type, :in => TYPES.keys | ||||
validates_numericality_of :delay, :allow_nil => true | validates_numericality_of :delay, :allow_nil => true | ||||
validates_uniqueness_of :issue_to_id, :scope => :issue_from_id | |||||
validates_uniqueness_of :issue_to_id, :scope => :issue_from_id, :case_sensitive => false | |||||
validate :validate_issue_relation | validate :validate_issue_relation | ||||
before_save :handle_issue_order | before_save :handle_issue_order |
before_destroy :delete_workflow_rules | before_destroy :delete_workflow_rules | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name | |||||
validates_uniqueness_of :name, :case_sensitive => false | |||||
validates_length_of :name, :maximum => 30 | validates_length_of :name, :maximum => 30 | ||||
validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true | validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true | ||||
belongs_to :project | belongs_to :project | ||||
validates_presence_of :principal, :project | validates_presence_of :principal, :project | ||||
validates_uniqueness_of :user_id, :scope => :project_id | |||||
validates_uniqueness_of :user_id, :scope => :project_id, :case_sensitive => false | |||||
validate :validate_role | validate :validate_role | ||||
before_destroy :set_issue_category_nil, :remove_from_project_default_assigned_to | before_destroy :set_issue_category_nil, :remove_from_project_default_assigned_to |
:author => nil | :author => nil | ||||
validates_presence_of :name, :identifier | validates_presence_of :name, :identifier | ||||
validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?} | |||||
validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}, :case_sensitive => false | |||||
validates_length_of :name, :maximum => 255 | validates_length_of :name, :maximum => 255 | ||||
validates_length_of :homepage, :maximum => 255 | validates_length_of :homepage, :maximum => 255 | ||||
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH | validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH |
validates_length_of :password, :maximum => 255, :allow_nil => true | validates_length_of :password, :maximum => 255, :allow_nil => true | ||||
validates_length_of :root_url, :url, maximum: 255 | validates_length_of :root_url, :url, maximum: 255 | ||||
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true | validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true | ||||
validates_uniqueness_of :identifier, :scope => :project_id | |||||
validates_uniqueness_of :identifier, :scope => :project_id, :case_sensitive => false | |||||
validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision) | validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision) | ||||
# donwcase letters, digits, dashes, underscores but not digits only | # donwcase letters, digits, dashes, underscores but not digits only | ||||
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true | validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true |
store :settings, :accessors => [:permissions_all_trackers, :permissions_tracker_ids] | store :settings, :accessors => [:permissions_all_trackers, :permissions_tracker_ids] | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name | |||||
validates_uniqueness_of :name, :case_sensitive => false | |||||
validates_length_of :name, :maximum => 255 | validates_length_of :name, :maximum => 255 | ||||
validates_inclusion_of( | validates_inclusion_of( | ||||
:issues_visibility, | :issues_visibility, |
cattr_accessor :available_settings | cattr_accessor :available_settings | ||||
self.available_settings ||= {} | self.available_settings ||= {} | ||||
validates_uniqueness_of :name, :if => Proc.new {|setting| setting.new_record? || setting.name_changed?} | |||||
validates_uniqueness_of :name, :case_sensitive => false, :if => Proc.new {|setting| setting.new_record? || setting.name_changed?} | |||||
validates_inclusion_of :name, :in => Proc.new {available_settings.keys} | validates_inclusion_of :name, :in => Proc.new {available_settings.keys} | ||||
validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting| | validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting| | ||||
(s = available_settings[setting.name]) && s['format'] == 'int' | (s = available_settings[setting.name]) && s['format'] == 'int' |
class Token < ActiveRecord::Base | class Token < ActiveRecord::Base | ||||
belongs_to :user | belongs_to :user | ||||
validates_uniqueness_of :value | |||||
validates_uniqueness_of :value, :case_sensitive => false | |||||
before_create :delete_previous_tokens, :generate_new_token | before_create :delete_previous_tokens, :generate_new_token | ||||
validates_presence_of :default_status | validates_presence_of :default_status | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name | |||||
validates_uniqueness_of :name, :case_sensitive => false | |||||
validates_length_of :name, :maximum => 30 | validates_length_of :name, :maximum => 30 | ||||
validates_length_of :description, :maximum => 255 | validates_length_of :description, :maximum => 255 | ||||
VERSION_SHARINGS = %w(none descendants hierarchy tree system) | VERSION_SHARINGS = %w(none descendants hierarchy tree system) | ||||
validates_presence_of :name | validates_presence_of :name | ||||
validates_uniqueness_of :name, :scope => [:project_id] | |||||
validates_uniqueness_of :name, :scope => [:project_id], :case_sensitive => false | |||||
validates_length_of :name, :maximum => 60 | validates_length_of :name, :maximum => 60 | ||||
validates_length_of :description, :wiki_page_title, :maximum => 255 | validates_length_of :description, :wiki_page_title, :maximum => 255 | ||||
validates :effective_date, :date => true | validates :effective_date, :date => true |
belongs_to :user | belongs_to :user | ||||
validates_presence_of :user | validates_presence_of :user | ||||
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] | |||||
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id], :case_sensitive => false | |||||
validate :validate_user | validate :validate_user | ||||
# Returns true if at least one object among objects is watched by user | # Returns true if at least one object among objects is watched by user |