set_table_name deprecated.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9550 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d940797aa7
commit
f2ec23d80c
|
@ -763,7 +763,7 @@ describe "AwesomeNestedSet" do
|
||||||
|
|
||||||
it "should not error on a model with attr_accessible" do
|
it "should not error on a model with attr_accessible" do
|
||||||
model = Class.new(ActiveRecord::Base)
|
model = Class.new(ActiveRecord::Base)
|
||||||
model.set_table_name 'categories'
|
model.table_name = 'categories'
|
||||||
model.attr_accessible :name
|
model.attr_accessible :name
|
||||||
lambda {
|
lambda {
|
||||||
model.acts_as_nested_set
|
model.acts_as_nested_set
|
||||||
|
|
|
@ -3,12 +3,12 @@ class Note < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
class Default < ActiveRecord::Base
|
class Default < ActiveRecord::Base
|
||||||
set_table_name 'categories'
|
self.table_name = 'categories'
|
||||||
acts_as_nested_set
|
acts_as_nested_set
|
||||||
end
|
end
|
||||||
|
|
||||||
class ScopedCategory < ActiveRecord::Base
|
class ScopedCategory < ActiveRecord::Base
|
||||||
set_table_name 'categories'
|
self.table_name = 'categories'
|
||||||
acts_as_nested_set :scope => :organization
|
acts_as_nested_set :scope => :organization
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ end
|
||||||
|
|
||||||
class DefaultWithCallbacks < ActiveRecord::Base
|
class DefaultWithCallbacks < ActiveRecord::Base
|
||||||
|
|
||||||
set_table_name 'categories'
|
self.table_name = 'categories'
|
||||||
|
|
||||||
attr_accessor :before_add, :after_add, :before_remove, :after_remove
|
attr_accessor :before_add, :after_add, :before_remove, :after_remove
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@ class AwesomeNestedSetTest < Test::Unit::TestCase
|
||||||
|
|
||||||
class Default < ActiveRecord::Base
|
class Default < ActiveRecord::Base
|
||||||
acts_as_nested_set
|
acts_as_nested_set
|
||||||
set_table_name 'categories'
|
self.table_name = 'categories'
|
||||||
end
|
end
|
||||||
class Scoped < ActiveRecord::Base
|
class Scoped < ActiveRecord::Base
|
||||||
acts_as_nested_set :scope => :organization
|
acts_as_nested_set :scope => :organization
|
||||||
set_table_name 'categories'
|
self.table_name = 'categories'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_left_column_default
|
def test_left_column_default
|
||||||
|
|
|
@ -3,5 +3,5 @@ class Developer < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
class DeVeLoPeR < ActiveRecord::Base
|
class DeVeLoPeR < ActiveRecord::Base
|
||||||
set_table_name "developers"
|
self.table_name = "developers"
|
||||||
end
|
end
|
||||||
|
|
|
@ -84,7 +84,7 @@ task :migrate_from_mantis => :environment do
|
||||||
}
|
}
|
||||||
|
|
||||||
class MantisUser < ActiveRecord::Base
|
class MantisUser < ActiveRecord::Base
|
||||||
set_table_name :mantis_user_table
|
self.table_name = :mantis_user_table
|
||||||
|
|
||||||
def firstname
|
def firstname
|
||||||
@firstname = realname.blank? ? username : realname.split.first[0..29]
|
@firstname = realname.blank? ? username : realname.split.first[0..29]
|
||||||
|
@ -112,7 +112,7 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisProject < ActiveRecord::Base
|
class MantisProject < ActiveRecord::Base
|
||||||
set_table_name :mantis_project_table
|
self.table_name = :mantis_project_table
|
||||||
has_many :versions, :class_name => "MantisVersion", :foreign_key => :project_id
|
has_many :versions, :class_name => "MantisVersion", :foreign_key => :project_id
|
||||||
has_many :categories, :class_name => "MantisCategory", :foreign_key => :project_id
|
has_many :categories, :class_name => "MantisCategory", :foreign_key => :project_id
|
||||||
has_many :news, :class_name => "MantisNews", :foreign_key => :project_id
|
has_many :news, :class_name => "MantisNews", :foreign_key => :project_id
|
||||||
|
@ -124,7 +124,7 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisVersion < ActiveRecord::Base
|
class MantisVersion < ActiveRecord::Base
|
||||||
set_table_name :mantis_project_version_table
|
self.table_name = :mantis_project_version_table
|
||||||
|
|
||||||
def version
|
def version
|
||||||
read_attribute(:version)[0..29]
|
read_attribute(:version)[0..29]
|
||||||
|
@ -136,15 +136,15 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisCategory < ActiveRecord::Base
|
class MantisCategory < ActiveRecord::Base
|
||||||
set_table_name :mantis_project_category_table
|
self.table_name = :mantis_project_category_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisProjectUser < ActiveRecord::Base
|
class MantisProjectUser < ActiveRecord::Base
|
||||||
set_table_name :mantis_project_user_list_table
|
self.table_name = :mantis_project_user_list_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBug < ActiveRecord::Base
|
class MantisBug < ActiveRecord::Base
|
||||||
set_table_name :mantis_bug_table
|
self.table_name = :mantis_bug_table
|
||||||
belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
|
belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
|
||||||
has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
|
has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
|
||||||
has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
|
has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
|
||||||
|
@ -152,7 +152,7 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBugText < ActiveRecord::Base
|
class MantisBugText < ActiveRecord::Base
|
||||||
set_table_name :mantis_bug_text_table
|
self.table_name = :mantis_bug_text_table
|
||||||
|
|
||||||
# Adds Mantis steps_to_reproduce and additional_information fields
|
# Adds Mantis steps_to_reproduce and additional_information fields
|
||||||
# to description if any
|
# to description if any
|
||||||
|
@ -165,17 +165,17 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBugNote < ActiveRecord::Base
|
class MantisBugNote < ActiveRecord::Base
|
||||||
set_table_name :mantis_bugnote_table
|
self.table_name = :mantis_bugnote_table
|
||||||
belongs_to :bug, :class_name => "MantisBug", :foreign_key => :bug_id
|
belongs_to :bug, :class_name => "MantisBug", :foreign_key => :bug_id
|
||||||
belongs_to :bug_note_text, :class_name => "MantisBugNoteText", :foreign_key => :bugnote_text_id
|
belongs_to :bug_note_text, :class_name => "MantisBugNoteText", :foreign_key => :bugnote_text_id
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBugNoteText < ActiveRecord::Base
|
class MantisBugNoteText < ActiveRecord::Base
|
||||||
set_table_name :mantis_bugnote_text_table
|
self.table_name = :mantis_bugnote_text_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBugFile < ActiveRecord::Base
|
class MantisBugFile < ActiveRecord::Base
|
||||||
set_table_name :mantis_bug_file_table
|
self.table_name = :mantis_bug_file_table
|
||||||
|
|
||||||
def size
|
def size
|
||||||
filesize
|
filesize
|
||||||
|
@ -200,19 +200,19 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBugRelationship < ActiveRecord::Base
|
class MantisBugRelationship < ActiveRecord::Base
|
||||||
set_table_name :mantis_bug_relationship_table
|
self.table_name = :mantis_bug_relationship_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisBugMonitor < ActiveRecord::Base
|
class MantisBugMonitor < ActiveRecord::Base
|
||||||
set_table_name :mantis_bug_monitor_table
|
self.table_name = :mantis_bug_monitor_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisNews < ActiveRecord::Base
|
class MantisNews < ActiveRecord::Base
|
||||||
set_table_name :mantis_news_table
|
self.table_name = :mantis_news_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisCustomField < ActiveRecord::Base
|
class MantisCustomField < ActiveRecord::Base
|
||||||
set_table_name :mantis_custom_field_table
|
self.table_name = :mantis_custom_field_table
|
||||||
set_inheritance_column :none
|
set_inheritance_column :none
|
||||||
has_many :values, :class_name => "MantisCustomFieldString", :foreign_key => :field_id
|
has_many :values, :class_name => "MantisCustomFieldString", :foreign_key => :field_id
|
||||||
has_many :projects, :class_name => "MantisCustomFieldProject", :foreign_key => :field_id
|
has_many :projects, :class_name => "MantisCustomFieldProject", :foreign_key => :field_id
|
||||||
|
@ -227,11 +227,11 @@ task :migrate_from_mantis => :environment do
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisCustomFieldProject < ActiveRecord::Base
|
class MantisCustomFieldProject < ActiveRecord::Base
|
||||||
set_table_name :mantis_custom_field_project_table
|
self.table_name = :mantis_custom_field_project_table
|
||||||
end
|
end
|
||||||
|
|
||||||
class MantisCustomFieldString < ActiveRecord::Base
|
class MantisCustomFieldString < ActiveRecord::Base
|
||||||
set_table_name :mantis_custom_field_string_table
|
self.table_name = :mantis_custom_field_string_table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,11 +85,11 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracComponent < ActiveRecord::Base
|
class TracComponent < ActiveRecord::Base
|
||||||
set_table_name :component
|
self.table_name = :component
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracMilestone < ActiveRecord::Base
|
class TracMilestone < ActiveRecord::Base
|
||||||
set_table_name :milestone
|
self.table_name = :milestone
|
||||||
# If this attribute is set a milestone has a defined target timepoint
|
# If this attribute is set a milestone has a defined target timepoint
|
||||||
def due
|
def due
|
||||||
if read_attribute(:due) && read_attribute(:due) > 0
|
if read_attribute(:due) && read_attribute(:due) > 0
|
||||||
|
@ -114,11 +114,11 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracTicketCustom < ActiveRecord::Base
|
class TracTicketCustom < ActiveRecord::Base
|
||||||
set_table_name :ticket_custom
|
self.table_name = :ticket_custom
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracAttachment < ActiveRecord::Base
|
class TracAttachment < ActiveRecord::Base
|
||||||
set_table_name :attachment
|
self.table_name = :attachment
|
||||||
set_inheritance_column :none
|
set_inheritance_column :none
|
||||||
|
|
||||||
def time; Time.at(read_attribute(:time)) end
|
def time; Time.at(read_attribute(:time)) end
|
||||||
|
@ -159,7 +159,7 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracTicket < ActiveRecord::Base
|
class TracTicket < ActiveRecord::Base
|
||||||
set_table_name :ticket
|
self.table_name = :ticket
|
||||||
set_inheritance_column :none
|
set_inheritance_column :none
|
||||||
|
|
||||||
# ticket changes: only migrate status changes and comments
|
# ticket changes: only migrate status changes and comments
|
||||||
|
@ -187,7 +187,7 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracTicketChange < ActiveRecord::Base
|
class TracTicketChange < ActiveRecord::Base
|
||||||
set_table_name :ticket_change
|
self.table_name = :ticket_change
|
||||||
|
|
||||||
def time; Time.at(read_attribute(:time)) end
|
def time; Time.at(read_attribute(:time)) end
|
||||||
end
|
end
|
||||||
|
@ -201,7 +201,7 @@ namespace :redmine do
|
||||||
CamelCase TitleIndex)
|
CamelCase TitleIndex)
|
||||||
|
|
||||||
class TracWikiPage < ActiveRecord::Base
|
class TracWikiPage < ActiveRecord::Base
|
||||||
set_table_name :wiki
|
self.table_name = :wiki
|
||||||
set_primary_key :name
|
set_primary_key :name
|
||||||
|
|
||||||
has_many :attachments, :class_name => "TracAttachment",
|
has_many :attachments, :class_name => "TracAttachment",
|
||||||
|
@ -218,11 +218,11 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracPermission < ActiveRecord::Base
|
class TracPermission < ActiveRecord::Base
|
||||||
set_table_name :permission
|
self.table_name = :permission
|
||||||
end
|
end
|
||||||
|
|
||||||
class TracSessionAttribute < ActiveRecord::Base
|
class TracSessionAttribute < ActiveRecord::Base
|
||||||
set_table_name :session_attribute
|
self.table_name = :session_attribute
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_or_create_user(username, project_member = false)
|
def self.find_or_create_user(username, project_member = false)
|
||||||
|
|
Loading…
Reference in New Issue