mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-09 09:01:31 +00:00
Removed unneeded :foreign_key option on belongs_to associations.
git-svn-id: http://svn.redmine.org/redmine/trunk@13484 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0fc1906201
commit
498a34403a
@ -20,7 +20,7 @@ require "fileutils"
|
||||
|
||||
class Attachment < ActiveRecord::Base
|
||||
belongs_to :container, :polymorphic => true
|
||||
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
||||
belongs_to :author, :class_name => "User"
|
||||
|
||||
validates_presence_of :filename, :author
|
||||
validates_length_of :filename, :maximum => 255
|
||||
|
||||
@ -20,7 +20,7 @@ class Board < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
has_many :topics, lambda {where("#{Message.table_name}.parent_id IS NULL").order("#{Message.table_name}.created_on DESC")}, :class_name => 'Message'
|
||||
has_many :messages, lambda {order("#{Message.table_name}.created_on DESC")}, :dependent => :destroy
|
||||
belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
|
||||
belongs_to :last_message, :class_name => 'Message'
|
||||
acts_as_tree :dependent => :nullify
|
||||
acts_as_list :scope => '(project_id = #{project_id} AND parent_id #{parent_id ? "= #{parent_id}" : "IS NULL"})'
|
||||
acts_as_watchable
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
class Comment < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :commented, :polymorphic => true, :counter_cache => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :author, :class_name => 'User'
|
||||
|
||||
validates_presence_of :commented, :author, :comments
|
||||
attr_protected :id
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
class Document < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
|
||||
belongs_to :category, :class_name => "DocumentCategory"
|
||||
acts_as_attachable :delete_permission => :delete_documents
|
||||
|
||||
acts_as_searchable :columns => ['title', "#{table_name}.description"],
|
||||
|
||||
@ -22,12 +22,12 @@ class Issue < ActiveRecord::Base
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :assigned_to, :class_name => 'Principal', :foreign_key => 'assigned_to_id'
|
||||
belongs_to :fixed_version, :class_name => 'Version', :foreign_key => 'fixed_version_id'
|
||||
belongs_to :priority, :class_name => 'IssuePriority', :foreign_key => 'priority_id'
|
||||
belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'
|
||||
belongs_to :status, :class_name => 'IssueStatus'
|
||||
belongs_to :author, :class_name => 'User'
|
||||
belongs_to :assigned_to, :class_name => 'Principal'
|
||||
belongs_to :fixed_version, :class_name => 'Version'
|
||||
belongs_to :priority, :class_name => 'IssuePriority'
|
||||
belongs_to :category, :class_name => 'IssueCategory'
|
||||
|
||||
has_many :journals, :as => :journalized, :dependent => :destroy
|
||||
has_many :visible_journals,
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
class IssueCategory < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
belongs_to :assigned_to, :class_name => 'Principal', :foreign_key => 'assigned_to_id'
|
||||
belongs_to :assigned_to, :class_name => 'Principal'
|
||||
has_many :issues, :foreign_key => 'category_id', :dependent => :nullify
|
||||
|
||||
validates_presence_of :name
|
||||
|
||||
@ -30,8 +30,8 @@ class IssueRelation < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id'
|
||||
belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id'
|
||||
belongs_to :issue_from, :class_name => 'Issue'
|
||||
belongs_to :issue_to, :class_name => 'Issue'
|
||||
|
||||
TYPE_RELATES = "relates"
|
||||
TYPE_DUPLICATES = "duplicates"
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
class Message < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :board
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :author, :class_name => 'User'
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
|
||||
acts_as_attachable
|
||||
belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id'
|
||||
belongs_to :last_reply, :class_name => 'Message'
|
||||
attr_protected :id
|
||||
|
||||
acts_as_searchable :columns => ['subject', 'content'],
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
class News < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :author, :class_name => 'User'
|
||||
has_many :comments, lambda {order("created_on")}, :as => :commented, :dependent => :delete_all
|
||||
|
||||
validates_presence_of :title, :description
|
||||
|
||||
@ -22,7 +22,7 @@ class TimeEntry < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
belongs_to :issue
|
||||
belongs_to :user
|
||||
belongs_to :activity, :class_name => 'TimeEntryActivity', :foreign_key => 'activity_id'
|
||||
belongs_to :activity, :class_name => 'TimeEntryActivity'
|
||||
|
||||
attr_protected :user_id, :tyear, :tmonth, :tweek
|
||||
|
||||
|
||||
@ -19,8 +19,8 @@ require 'zlib'
|
||||
|
||||
class WikiContent < ActiveRecord::Base
|
||||
self.locking_column = 'version'
|
||||
belongs_to :page, :class_name => 'WikiPage', :foreign_key => 'page_id'
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
belongs_to :page, :class_name => 'WikiPage'
|
||||
belongs_to :author, :class_name => 'User'
|
||||
validates_presence_of :text
|
||||
validates_length_of :comments, :maximum => 255, :allow_nil => true
|
||||
attr_protected :id
|
||||
@ -54,8 +54,8 @@ class WikiContent < ActiveRecord::Base
|
||||
end
|
||||
|
||||
class Version
|
||||
belongs_to :page, :class_name => '::WikiPage', :foreign_key => 'page_id'
|
||||
belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'
|
||||
belongs_to :page, :class_name => '::WikiPage'
|
||||
belongs_to :author, :class_name => '::User'
|
||||
attr_protected :data
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
|
||||
|
||||
@ -20,8 +20,8 @@ class WorkflowRule < ActiveRecord::Base
|
||||
|
||||
belongs_to :role
|
||||
belongs_to :tracker
|
||||
belongs_to :old_status, :class_name => 'IssueStatus', :foreign_key => 'old_status_id'
|
||||
belongs_to :new_status, :class_name => 'IssueStatus', :foreign_key => 'new_status_id'
|
||||
belongs_to :old_status, :class_name => 'IssueStatus'
|
||||
belongs_to :new_status, :class_name => 'IssueStatus'
|
||||
|
||||
validates_presence_of :role, :tracker, :old_status
|
||||
attr_protected :id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user