##// END OF EJS Templates
set_table_name deprecated....
Jean-Philippe Lang -
r9368:f2ec23d80cf4
parent child
Show More
@@ -763,7 +763,7 describe "AwesomeNestedSet" do
763
763
764 it "should not error on a model with attr_accessible" do
764 it "should not error on a model with attr_accessible" do
765 model = Class.new(ActiveRecord::Base)
765 model = Class.new(ActiveRecord::Base)
766 model.set_table_name 'categories'
766 model.table_name = 'categories'
767 model.attr_accessible :name
767 model.attr_accessible :name
768 lambda {
768 lambda {
769 model.acts_as_nested_set
769 model.acts_as_nested_set
@@ -3,12 +3,12 class Note < ActiveRecord::Base
3 end
3 end
4
4
5 class Default < ActiveRecord::Base
5 class Default < ActiveRecord::Base
6 set_table_name 'categories'
6 self.table_name = 'categories'
7 acts_as_nested_set
7 acts_as_nested_set
8 end
8 end
9
9
10 class ScopedCategory < ActiveRecord::Base
10 class ScopedCategory < ActiveRecord::Base
11 set_table_name 'categories'
11 self.table_name = 'categories'
12 acts_as_nested_set :scope => :organization
12 acts_as_nested_set :scope => :organization
13 end
13 end
14
14
@@ -48,7 +48,7 end
48
48
49 class DefaultWithCallbacks < ActiveRecord::Base
49 class DefaultWithCallbacks < ActiveRecord::Base
50
50
51 set_table_name 'categories'
51 self.table_name = 'categories'
52
52
53 attr_accessor :before_add, :after_add, :before_remove, :after_remove
53 attr_accessor :before_add, :after_add, :before_remove, :after_remove
54
54
@@ -8,11 +8,11 class AwesomeNestedSetTest < Test::Unit::TestCase
8
8
9 class Default < ActiveRecord::Base
9 class Default < ActiveRecord::Base
10 acts_as_nested_set
10 acts_as_nested_set
11 set_table_name 'categories'
11 self.table_name = 'categories'
12 end
12 end
13 class Scoped < ActiveRecord::Base
13 class Scoped < ActiveRecord::Base
14 acts_as_nested_set :scope => :organization
14 acts_as_nested_set :scope => :organization
15 set_table_name 'categories'
15 self.table_name = 'categories'
16 end
16 end
17
17
18 def test_left_column_default
18 def test_left_column_default
@@ -3,5 +3,5 class Developer < ActiveRecord::Base
3 end
3 end
4
4
5 class DeVeLoPeR < ActiveRecord::Base
5 class DeVeLoPeR < ActiveRecord::Base
6 set_table_name "developers"
6 self.table_name = "developers"
7 end
7 end
@@ -84,7 +84,7 task :migrate_from_mantis => :environment do
84 }
84 }
85
85
86 class MantisUser < ActiveRecord::Base
86 class MantisUser < ActiveRecord::Base
87 set_table_name :mantis_user_table
87 self.table_name = :mantis_user_table
88
88
89 def firstname
89 def firstname
90 @firstname = realname.blank? ? username : realname.split.first[0..29]
90 @firstname = realname.blank? ? username : realname.split.first[0..29]
@@ -112,7 +112,7 task :migrate_from_mantis => :environment do
112 end
112 end
113
113
114 class MantisProject < ActiveRecord::Base
114 class MantisProject < ActiveRecord::Base
115 set_table_name :mantis_project_table
115 self.table_name = :mantis_project_table
116 has_many :versions, :class_name => "MantisVersion", :foreign_key => :project_id
116 has_many :versions, :class_name => "MantisVersion", :foreign_key => :project_id
117 has_many :categories, :class_name => "MantisCategory", :foreign_key => :project_id
117 has_many :categories, :class_name => "MantisCategory", :foreign_key => :project_id
118 has_many :news, :class_name => "MantisNews", :foreign_key => :project_id
118 has_many :news, :class_name => "MantisNews", :foreign_key => :project_id
@@ -124,7 +124,7 task :migrate_from_mantis => :environment do
124 end
124 end
125
125
126 class MantisVersion < ActiveRecord::Base
126 class MantisVersion < ActiveRecord::Base
127 set_table_name :mantis_project_version_table
127 self.table_name = :mantis_project_version_table
128
128
129 def version
129 def version
130 read_attribute(:version)[0..29]
130 read_attribute(:version)[0..29]
@@ -136,15 +136,15 task :migrate_from_mantis => :environment do
136 end
136 end
137
137
138 class MantisCategory < ActiveRecord::Base
138 class MantisCategory < ActiveRecord::Base
139 set_table_name :mantis_project_category_table
139 self.table_name = :mantis_project_category_table
140 end
140 end
141
141
142 class MantisProjectUser < ActiveRecord::Base
142 class MantisProjectUser < ActiveRecord::Base
143 set_table_name :mantis_project_user_list_table
143 self.table_name = :mantis_project_user_list_table
144 end
144 end
145
145
146 class MantisBug < ActiveRecord::Base
146 class MantisBug < ActiveRecord::Base
147 set_table_name :mantis_bug_table
147 self.table_name = :mantis_bug_table
148 belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
148 belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
149 has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
149 has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
150 has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
150 has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
@@ -152,7 +152,7 task :migrate_from_mantis => :environment do
152 end
152 end
153
153
154 class MantisBugText < ActiveRecord::Base
154 class MantisBugText < ActiveRecord::Base
155 set_table_name :mantis_bug_text_table
155 self.table_name = :mantis_bug_text_table
156
156
157 # Adds Mantis steps_to_reproduce and additional_information fields
157 # Adds Mantis steps_to_reproduce and additional_information fields
158 # to description if any
158 # to description if any
@@ -165,17 +165,17 task :migrate_from_mantis => :environment do
165 end
165 end
166
166
167 class MantisBugNote < ActiveRecord::Base
167 class MantisBugNote < ActiveRecord::Base
168 set_table_name :mantis_bugnote_table
168 self.table_name = :mantis_bugnote_table
169 belongs_to :bug, :class_name => "MantisBug", :foreign_key => :bug_id
169 belongs_to :bug, :class_name => "MantisBug", :foreign_key => :bug_id
170 belongs_to :bug_note_text, :class_name => "MantisBugNoteText", :foreign_key => :bugnote_text_id
170 belongs_to :bug_note_text, :class_name => "MantisBugNoteText", :foreign_key => :bugnote_text_id
171 end
171 end
172
172
173 class MantisBugNoteText < ActiveRecord::Base
173 class MantisBugNoteText < ActiveRecord::Base
174 set_table_name :mantis_bugnote_text_table
174 self.table_name = :mantis_bugnote_text_table
175 end
175 end
176
176
177 class MantisBugFile < ActiveRecord::Base
177 class MantisBugFile < ActiveRecord::Base
178 set_table_name :mantis_bug_file_table
178 self.table_name = :mantis_bug_file_table
179
179
180 def size
180 def size
181 filesize
181 filesize
@@ -200,19 +200,19 task :migrate_from_mantis => :environment do
200 end
200 end
201
201
202 class MantisBugRelationship < ActiveRecord::Base
202 class MantisBugRelationship < ActiveRecord::Base
203 set_table_name :mantis_bug_relationship_table
203 self.table_name = :mantis_bug_relationship_table
204 end
204 end
205
205
206 class MantisBugMonitor < ActiveRecord::Base
206 class MantisBugMonitor < ActiveRecord::Base
207 set_table_name :mantis_bug_monitor_table
207 self.table_name = :mantis_bug_monitor_table
208 end
208 end
209
209
210 class MantisNews < ActiveRecord::Base
210 class MantisNews < ActiveRecord::Base
211 set_table_name :mantis_news_table
211 self.table_name = :mantis_news_table
212 end
212 end
213
213
214 class MantisCustomField < ActiveRecord::Base
214 class MantisCustomField < ActiveRecord::Base
215 set_table_name :mantis_custom_field_table
215 self.table_name = :mantis_custom_field_table
216 set_inheritance_column :none
216 set_inheritance_column :none
217 has_many :values, :class_name => "MantisCustomFieldString", :foreign_key => :field_id
217 has_many :values, :class_name => "MantisCustomFieldString", :foreign_key => :field_id
218 has_many :projects, :class_name => "MantisCustomFieldProject", :foreign_key => :field_id
218 has_many :projects, :class_name => "MantisCustomFieldProject", :foreign_key => :field_id
@@ -227,11 +227,11 task :migrate_from_mantis => :environment do
227 end
227 end
228
228
229 class MantisCustomFieldProject < ActiveRecord::Base
229 class MantisCustomFieldProject < ActiveRecord::Base
230 set_table_name :mantis_custom_field_project_table
230 self.table_name = :mantis_custom_field_project_table
231 end
231 end
232
232
233 class MantisCustomFieldString < ActiveRecord::Base
233 class MantisCustomFieldString < ActiveRecord::Base
234 set_table_name :mantis_custom_field_string_table
234 self.table_name = :mantis_custom_field_string_table
235 end
235 end
236
236
237
237
@@ -85,11 +85,11 namespace :redmine do
85 end
85 end
86
86
87 class TracComponent < ActiveRecord::Base
87 class TracComponent < ActiveRecord::Base
88 set_table_name :component
88 self.table_name = :component
89 end
89 end
90
90
91 class TracMilestone < ActiveRecord::Base
91 class TracMilestone < ActiveRecord::Base
92 set_table_name :milestone
92 self.table_name = :milestone
93 # If this attribute is set a milestone has a defined target timepoint
93 # If this attribute is set a milestone has a defined target timepoint
94 def due
94 def due
95 if read_attribute(:due) && read_attribute(:due) > 0
95 if read_attribute(:due) && read_attribute(:due) > 0
@@ -114,11 +114,11 namespace :redmine do
114 end
114 end
115
115
116 class TracTicketCustom < ActiveRecord::Base
116 class TracTicketCustom < ActiveRecord::Base
117 set_table_name :ticket_custom
117 self.table_name = :ticket_custom
118 end
118 end
119
119
120 class TracAttachment < ActiveRecord::Base
120 class TracAttachment < ActiveRecord::Base
121 set_table_name :attachment
121 self.table_name = :attachment
122 set_inheritance_column :none
122 set_inheritance_column :none
123
123
124 def time; Time.at(read_attribute(:time)) end
124 def time; Time.at(read_attribute(:time)) end
@@ -159,7 +159,7 namespace :redmine do
159 end
159 end
160
160
161 class TracTicket < ActiveRecord::Base
161 class TracTicket < ActiveRecord::Base
162 set_table_name :ticket
162 self.table_name = :ticket
163 set_inheritance_column :none
163 set_inheritance_column :none
164
164
165 # ticket changes: only migrate status changes and comments
165 # ticket changes: only migrate status changes and comments
@@ -187,7 +187,7 namespace :redmine do
187 end
187 end
188
188
189 class TracTicketChange < ActiveRecord::Base
189 class TracTicketChange < ActiveRecord::Base
190 set_table_name :ticket_change
190 self.table_name = :ticket_change
191
191
192 def time; Time.at(read_attribute(:time)) end
192 def time; Time.at(read_attribute(:time)) end
193 end
193 end
@@ -201,7 +201,7 namespace :redmine do
201 CamelCase TitleIndex)
201 CamelCase TitleIndex)
202
202
203 class TracWikiPage < ActiveRecord::Base
203 class TracWikiPage < ActiveRecord::Base
204 set_table_name :wiki
204 self.table_name = :wiki
205 set_primary_key :name
205 set_primary_key :name
206
206
207 has_many :attachments, :class_name => "TracAttachment",
207 has_many :attachments, :class_name => "TracAttachment",
@@ -218,11 +218,11 namespace :redmine do
218 end
218 end
219
219
220 class TracPermission < ActiveRecord::Base
220 class TracPermission < ActiveRecord::Base
221 set_table_name :permission
221 self.table_name = :permission
222 end
222 end
223
223
224 class TracSessionAttribute < ActiveRecord::Base
224 class TracSessionAttribute < ActiveRecord::Base
225 set_table_name :session_attribute
225 self.table_name = :session_attribute
226 end
226 end
227
227
228 def self.find_or_create_user(username, project_member = false)
228 def self.find_or_create_user(username, project_member = false)
General Comments 0
You need to be logged in to leave comments. Login now