##// END OF EJS Templates
replaced deprecated ":dependent => true" statements...
Jean-Philippe Lang -
r120:b4d4b80dcd53
parent child
Show More
@@ -1,3 +1,20
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
1 class Comment < ActiveRecord::Base
18 class Comment < ActiveRecord::Base
2 belongs_to :commented, :polymorphic => true, :counter_cache => true
19 belongs_to :commented, :polymorphic => true, :counter_cache => true
3 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
20 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
@@ -16,7 +16,7
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class CustomField < ActiveRecord::Base
18 class CustomField < ActiveRecord::Base
19 has_many :custom_values, :dependent => true
19 has_many :custom_values, :dependent => :delete_all
20
20
21 FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },
21 FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },
22 "text" => { :name => :label_text, :order => 2 },
22 "text" => { :name => :label_text, :order => 2 },
@@ -18,7 +18,7
18 class Document < ActiveRecord::Base
18 class Document < ActiveRecord::Base
19 belongs_to :project
19 belongs_to :project
20 belongs_to :category, :class_name => "Enumeration", :foreign_key => "category_id"
20 belongs_to :category, :class_name => "Enumeration", :foreign_key => "category_id"
21 has_many :attachments, :as => :container, :dependent => true
21 has_many :attachments, :as => :container, :dependent => :destroy
22
22
23 validates_presence_of :project, :title, :category
23 validates_presence_of :project, :title, :category
24 end
24 end
@@ -26,11 +26,10 class Issue < ActiveRecord::Base
26 belongs_to :priority, :class_name => 'Enumeration', :foreign_key => 'priority_id'
26 belongs_to :priority, :class_name => 'Enumeration', :foreign_key => 'priority_id'
27 belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'
27 belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'
28
28
29 #has_many :histories, :class_name => 'IssueHistory', :dependent => true, :order => "issue_histories.created_on DESC", :include => :status
29 has_many :journals, :as => :journalized, :dependent => :destroy
30 has_many :journals, :as => :journalized, :dependent => true
30 has_many :attachments, :as => :container, :dependent => :destroy
31 has_many :attachments, :as => :container, :dependent => true
32
31
33 has_many :custom_values, :dependent => true, :as => :customized
32 has_many :custom_values, :dependent => :delete_all, :as => :customized
34 has_many :custom_fields, :through => :custom_values
33 has_many :custom_fields, :through => :custom_values
35
34
36 validates_presence_of :subject, :description, :priority, :tracker, :author, :status
35 validates_presence_of :subject, :description, :priority, :tracker, :author, :status
@@ -18,5 +18,5
18 class Journal < ActiveRecord::Base
18 class Journal < ActiveRecord::Base
19 belongs_to :journalized, :polymorphic => true
19 belongs_to :journalized, :polymorphic => true
20 belongs_to :user
20 belongs_to :user
21 has_many :details, :class_name => "JournalDetail", :dependent => true
21 has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
22 end
22 end
@@ -18,7 +18,7
18 class News < ActiveRecord::Base
18 class News < ActiveRecord::Base
19 belongs_to :project
19 belongs_to :project
20 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
20 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
21 has_many :comments, :as => :commented, :dependent => true, :order => "created_on"
21 has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
22
22
23 validates_presence_of :title, :description
23 validates_presence_of :title, :description
24
24
@@ -16,16 +16,16
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class Project < ActiveRecord::Base
18 class Project < ActiveRecord::Base
19 has_many :versions, :dependent => true, :order => "versions.effective_date DESC, versions.name DESC"
19 has_many :versions, :dependent => :destroy, :order => "versions.effective_date DESC, versions.name DESC"
20 has_many :members, :dependent => true, :include => :user, :conditions => "users.status=#{User::STATUS_ACTIVE}"
20 has_many :members, :dependent => :delete_all, :include => :user, :conditions => "users.status=#{User::STATUS_ACTIVE}"
21 has_many :users, :through => :members
21 has_many :users, :through => :members
22 has_many :custom_values, :dependent => true, :as => :customized
22 has_many :custom_values, :dependent => :delete_all, :as => :customized
23 has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => [:status, :tracker]
23 has_many :issues, :dependent => :destroy, :order => "issues.created_on DESC", :include => [:status, :tracker]
24 has_many :queries, :dependent => true
24 has_many :queries, :dependent => :delete_all
25 has_many :documents, :dependent => true
25 has_many :documents, :dependent => :destroy
26 has_many :news, :dependent => true, :include => :author
26 has_many :news, :dependent => :delete_all, :include => :author
27 has_many :issue_categories, :dependent => true, :order => "issue_categories.name"
27 has_many :issue_categories, :dependent => :delete_all, :order => "issue_categories.name"
28 has_one :repository, :dependent => true
28 has_one :repository, :dependent => :destroy
29 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_projects', :association_foreign_key => 'custom_field_id'
29 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_projects', :association_foreign_key => 'custom_field_id'
30 acts_as_tree :order => "name", :counter_cache => true
30 acts_as_tree :order => "name", :counter_cache => true
31
31
@@ -18,7 +18,7
18 class Role < ActiveRecord::Base
18 class Role < ActiveRecord::Base
19 before_destroy :check_integrity
19 before_destroy :check_integrity
20 has_and_belongs_to_many :permissions
20 has_and_belongs_to_many :permissions
21 has_many :workflows, :dependent => true
21 has_many :workflows, :dependent => :delete_all
22 has_many :members
22 has_many :members
23
23
24 validates_presence_of :name
24 validates_presence_of :name
@@ -18,7 +18,7
18 class Tracker < ActiveRecord::Base
18 class Tracker < ActiveRecord::Base
19 before_destroy :check_integrity
19 before_destroy :check_integrity
20 has_many :issues
20 has_many :issues
21 has_many :workflows, :dependent => true
21 has_many :workflows, :dependent => :delete_all
22 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
22 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
23
23
24 validates_presence_of :name
24 validates_presence_of :name
@@ -18,10 +18,10
18 require "digest/sha1"
18 require "digest/sha1"
19
19
20 class User < ActiveRecord::Base
20 class User < ActiveRecord::Base
21 has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => true
21 has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => :delete_all
22 has_many :projects, :through => :memberships
22 has_many :projects, :through => :memberships
23 has_many :custom_values, :dependent => true, :as => :customized
23 has_many :custom_values, :dependent => :delete_all, :as => :customized
24 has_one :preference, :dependent => true, :class_name => 'UserPreference'
24 has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
25 belongs_to :auth_source
25 belongs_to :auth_source
26
26
27 attr_accessor :password, :password_confirmation
27 attr_accessor :password, :password_confirmation
@@ -19,7 +19,7 class Version < ActiveRecord::Base
19 before_destroy :check_integrity
19 before_destroy :check_integrity
20 belongs_to :project
20 belongs_to :project
21 has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
21 has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
22 has_many :attachments, :as => :container, :dependent => true
22 has_many :attachments, :as => :container, :dependent => :destroy
23
23
24 validates_presence_of :name
24 validates_presence_of :name
25 validates_uniqueness_of :name, :scope => [:project_id]
25 validates_uniqueness_of :name, :scope => [:project_id]
General Comments 0
You need to be logged in to leave comments. Login now