activerecord 3.0.0.beta4 → 3.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

Files changed (69) hide show
  1. data/CHANGELOG +267 -254
  2. data/README.rdoc +222 -0
  3. data/examples/performance.rb +9 -9
  4. data/lib/active_record/aggregations.rb +3 -4
  5. data/lib/active_record/association_preload.rb +15 -10
  6. data/lib/active_record/associations.rb +54 -37
  7. data/lib/active_record/associations/association_collection.rb +43 -17
  8. data/lib/active_record/associations/association_proxy.rb +2 -0
  9. data/lib/active_record/associations/belongs_to_association.rb +1 -0
  10. data/lib/active_record/associations/belongs_to_polymorphic_association.rb +1 -0
  11. data/lib/active_record/associations/has_and_belongs_to_many_association.rb +22 -7
  12. data/lib/active_record/associations/has_many_association.rb +6 -1
  13. data/lib/active_record/associations/has_many_through_association.rb +1 -0
  14. data/lib/active_record/associations/has_one_association.rb +1 -0
  15. data/lib/active_record/associations/has_one_through_association.rb +1 -0
  16. data/lib/active_record/associations/through_association_scope.rb +3 -2
  17. data/lib/active_record/attribute_methods.rb +1 -0
  18. data/lib/active_record/autosave_association.rb +4 -6
  19. data/lib/active_record/base.rb +106 -240
  20. data/lib/active_record/callbacks.rb +4 -25
  21. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +22 -29
  22. data/lib/active_record/connection_adapters/abstract/connection_specification.rb +2 -8
  23. data/lib/active_record/connection_adapters/abstract/database_statements.rb +2 -2
  24. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +10 -0
  25. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +56 -7
  26. data/lib/active_record/connection_adapters/abstract_adapter.rb +10 -18
  27. data/lib/active_record/connection_adapters/mysql_adapter.rb +2 -2
  28. data/lib/active_record/connection_adapters/postgresql_adapter.rb +65 -69
  29. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +19 -6
  30. data/lib/active_record/connection_adapters/sqlite_adapter.rb +20 -46
  31. data/lib/active_record/counter_cache.rb +14 -4
  32. data/lib/active_record/dynamic_finder_match.rb +9 -0
  33. data/lib/active_record/dynamic_scope_match.rb +7 -0
  34. data/lib/active_record/errors.rb +3 -0
  35. data/lib/active_record/fixtures.rb +5 -6
  36. data/lib/active_record/locale/en.yml +1 -1
  37. data/lib/active_record/locking/optimistic.rb +1 -0
  38. data/lib/active_record/log_subscriber.rb +48 -0
  39. data/lib/active_record/migration.rb +64 -37
  40. data/lib/active_record/named_scope.rb +33 -19
  41. data/lib/active_record/nested_attributes.rb +17 -13
  42. data/lib/active_record/observer.rb +13 -6
  43. data/lib/active_record/persistence.rb +55 -22
  44. data/lib/active_record/query_cache.rb +1 -0
  45. data/lib/active_record/railtie.rb +14 -8
  46. data/lib/active_record/railties/controller_runtime.rb +2 -2
  47. data/lib/active_record/railties/databases.rake +63 -33
  48. data/lib/active_record/reflection.rb +46 -28
  49. data/lib/active_record/relation.rb +38 -24
  50. data/lib/active_record/relation/finder_methods.rb +5 -5
  51. data/lib/active_record/relation/predicate_builder.rb +2 -4
  52. data/lib/active_record/relation/query_methods.rb +134 -115
  53. data/lib/active_record/relation/spawn_methods.rb +1 -1
  54. data/lib/active_record/schema.rb +2 -0
  55. data/lib/active_record/schema_dumper.rb +15 -12
  56. data/lib/active_record/serialization.rb +2 -0
  57. data/lib/active_record/session_store.rb +93 -79
  58. data/lib/active_record/test_case.rb +3 -0
  59. data/lib/active_record/timestamp.rb +49 -29
  60. data/lib/active_record/transactions.rb +5 -2
  61. data/lib/active_record/validations.rb +5 -2
  62. data/lib/active_record/validations/associated.rb +1 -1
  63. data/lib/active_record/validations/uniqueness.rb +1 -1
  64. data/lib/active_record/version.rb +1 -1
  65. data/lib/rails/generators/active_record/migration/templates/migration.rb +12 -6
  66. data/lib/rails/generators/active_record/model/model_generator.rb +1 -1
  67. metadata +27 -14
  68. data/README +0 -351
  69. data/lib/active_record/railties/log_subscriber.rb +0 -32
@@ -1,6 +1,8 @@
1
1
  require 'active_support/core_ext/array/wrap'
2
2
 
3
3
  module ActiveRecord
4
+ # = Active Record Callbacks
5
+ #
4
6
  # Callbacks are hooks into the lifecycle of an Active Record object that allow you to trigger logic
5
7
  # before or after an alteration of the object state. This can be used to make sure that associated and
6
8
  # dependent objects are deleted when +destroy+ is called (by overwriting +before_destroy+) or to massage attributes
@@ -234,8 +236,7 @@ module ActiveRecord
234
236
 
235
237
  included do
236
238
  extend ActiveModel::Callbacks
237
-
238
- define_callbacks :validation, :terminator => "result == false", :scope => [:kind, :name]
239
+ include ActiveModel::Validations::Callbacks
239
240
 
240
241
  define_model_callbacks :initialize, :find, :only => :after
241
242
  define_model_callbacks :save, :create, :update, :destroy
@@ -249,29 +250,6 @@ module ActiveRecord
249
250
  send(meth.to_sym, meth.to_sym)
250
251
  end
251
252
  end
252
-
253
- def before_validation(*args, &block)
254
- options = args.last
255
- if options.is_a?(Hash) && options[:on]
256
- options[:if] = Array.wrap(options[:if])
257
- options[:if] << "@_on_validate == :#{options[:on]}"
258
- end
259
- set_callback(:validation, :before, *args, &block)
260
- end
261
-
262
- def after_validation(*args, &block)
263
- options = args.extract_options!
264
- options[:prepend] = true
265
- options[:if] = Array.wrap(options[:if])
266
- options[:if] << "!halted && value != false"
267
- options[:if] << "@_on_validate == :#{options[:on]}" if options[:on]
268
- set_callback(:validation, :after, *(args << options), &block)
269
- end
270
- end
271
-
272
- def valid?(*) #:nodoc:
273
- @_on_validate = new_record? ? :create : :update
274
- _run_validation_callbacks { super }
275
253
  end
276
254
 
277
255
  def destroy #:nodoc:
@@ -286,6 +264,7 @@ module ActiveRecord
286
264
  end
287
265
 
288
266
  private
267
+
289
268
  def create_or_update #:nodoc:
290
269
  _run_save_callbacks { super }
291
270
  end
@@ -9,7 +9,7 @@ module ActiveRecord
9
9
  end
10
10
 
11
11
  module ConnectionAdapters
12
- # Connection pool base class for managing ActiveRecord database
12
+ # Connection pool base class for managing Active Record database
13
13
  # connections.
14
14
  #
15
15
  # == Introduction
@@ -30,12 +30,12 @@ module ActiveRecord
30
30
  # Connections can be obtained and used from a connection pool in several
31
31
  # ways:
32
32
  #
33
- # 1. Simply use ActiveRecord::Base.connection as with ActiveRecord 2.1 and
33
+ # 1. Simply use ActiveRecord::Base.connection as with Active Record 2.1 and
34
34
  # earlier (pre-connection-pooling). Eventually, when you're done with
35
35
  # the connection(s) and wish it to be returned to the pool, you call
36
36
  # ActiveRecord::Base.clear_active_connections!. This will be the
37
- # default behavior for ActiveRecord when used in conjunction with
38
- # ActionPack's request handling cycle.
37
+ # default behavior for Active Record when used in conjunction with
38
+ # Action Pack's request handling cycle.
39
39
  # 2. Manually check out a connection from the pool with
40
40
  # ActiveRecord::Base.connection_pool.checkout. You are responsible for
41
41
  # returning this connection to the pool when finished by calling
@@ -144,7 +144,9 @@ module ActiveRecord
144
144
  @connections.each do |conn|
145
145
  conn.disconnect! if conn.requires_reloading?
146
146
  end
147
- @connections = []
147
+ @connections.delete_if do |conn|
148
+ conn.requires_reloading?
149
+ end
148
150
  end
149
151
 
150
152
  # Verify active connections and remove and disconnect connections
@@ -159,8 +161,13 @@ module ActiveRecord
159
161
  # Return any checked-out connections back to the pool by threads that
160
162
  # are no longer alive.
161
163
  def clear_stale_cached_connections!
162
- remove_stale_cached_threads!(@reserved_connections) do |name, conn|
163
- checkin conn
164
+ keys = @reserved_connections.keys - Thread.list.find_all { |t|
165
+ t.alive?
166
+ }.map { |thread| thread.object_id }
167
+
168
+ keys.each do |key|
169
+ checkin @reserved_connections[key]
170
+ @reserved_connections.delete(key)
164
171
  end
165
172
  end
166
173
 
@@ -230,20 +237,6 @@ module ActiveRecord
230
237
  Thread.current.object_id
231
238
  end
232
239
 
233
- # Remove stale threads from the cache.
234
- def remove_stale_cached_threads!(cache, &block)
235
- keys = Set.new(cache.keys)
236
-
237
- Thread.list.each do |thread|
238
- keys.delete(thread.object_id) if thread.alive?
239
- end
240
- keys.each do |key|
241
- next unless cache.has_key?(key)
242
- block.call(key, cache[key])
243
- cache.delete(key)
244
- end
245
- end
246
-
247
240
  def checkout_new_connection
248
241
  c = new_connection
249
242
  @connections << c
@@ -265,7 +258,7 @@ module ActiveRecord
265
258
  end
266
259
 
267
260
  # ConnectionHandler is a collection of ConnectionPool objects. It is used
268
- # for keeping separate connection pools for ActiveRecord models that connect
261
+ # for keeping separate connection pools for Active Record models that connect
269
262
  # to different databases.
270
263
  #
271
264
  # For example, suppose that you have 5 models, with the following hierarchy:
@@ -285,17 +278,15 @@ module ActiveRecord
285
278
  # is not the same as the one used by Book/ScaryBook/GoodBook.
286
279
  #
287
280
  # Normally there is only a single ConnectionHandler instance, accessible via
288
- # ActiveRecord::Base.connection_handler. ActiveRecord models use this to
281
+ # ActiveRecord::Base.connection_handler. Active Record models use this to
289
282
  # determine that connection pool that they should use.
290
283
  class ConnectionHandler
284
+ attr_reader :connection_pools
285
+
291
286
  def initialize(pools = {})
292
287
  @connection_pools = pools
293
288
  end
294
289
 
295
- def connection_pools
296
- @connection_pools ||= {}
297
- end
298
-
299
290
  def establish_connection(name, spec)
300
291
  @connection_pools[name] = ConnectionAdapters::ConnectionPool.new(spec)
301
292
  end
@@ -343,9 +334,11 @@ module ActiveRecord
343
334
  # re-establishing the connection.
344
335
  def remove_connection(klass)
345
336
  pool = @connection_pools[klass.name]
337
+ return nil unless pool
338
+
346
339
  @connection_pools.delete_if { |key, value| value == pool }
347
- pool.disconnect! if pool
348
- pool.spec.config if pool
340
+ pool.disconnect!
341
+ pool.spec.config
349
342
  end
350
343
 
351
344
  def retrieve_connection_pool(klass)
@@ -66,15 +66,9 @@ module ActiveRecord
66
66
  unless spec.key?(:adapter) then raise AdapterNotSpecified, "database configuration does not specify adapter" end
67
67
 
68
68
  begin
69
- require 'rubygems'
70
- gem "activerecord-#{spec[:adapter]}-adapter"
71
69
  require "active_record/connection_adapters/#{spec[:adapter]}_adapter"
72
70
  rescue LoadError
73
- begin
74
- require "active_record/connection_adapters/#{spec[:adapter]}_adapter"
75
- rescue LoadError
76
- raise "Please install the #{spec[:adapter]} adapter: `gem install activerecord-#{spec[:adapter]}-adapter` (#{$!})"
77
- end
71
+ raise "Please install the #{spec[:adapter]} adapter: `gem install activerecord-#{spec[:adapter]}-adapter` (#{$!})"
78
72
  end
79
73
 
80
74
  adapter_method = "#{spec[:adapter]}_connection"
@@ -103,7 +97,7 @@ module ActiveRecord
103
97
  connection_handler.retrieve_connection(self)
104
98
  end
105
99
 
106
- # Returns true if +ActiveRecord+ is connected.
100
+ # Returns true if Active Record is connected.
107
101
  def connected?
108
102
  connection_handler.connected?(self)
109
103
  end
@@ -304,7 +304,7 @@ module ActiveRecord
304
304
  begin
305
305
  record.rolledback!(rollback)
306
306
  rescue Exception => e
307
- record.logger.error(e) if record.respond_to?(:logger)
307
+ record.logger.error(e) if record.respond_to?(:logger) && record.logger
308
308
  end
309
309
  end
310
310
  end
@@ -319,7 +319,7 @@ module ActiveRecord
319
319
  begin
320
320
  record.committed!
321
321
  rescue Exception => e
322
- record.logger.error(e) if record.respond_to?(:logger)
322
+ record.logger.error(e) if record.respond_to?(:logger) && record.logger
323
323
  end
324
324
  end
325
325
  end
@@ -582,6 +582,11 @@ module ActiveRecord
582
582
  @base.add_column(@table_name, column_name, type, options)
583
583
  end
584
584
 
585
+ # Checks to see if a column exists. See SchemaStatements#column_exists?
586
+ def column_exists?(column_name, type = nil, options = nil)
587
+ @base.column_exists?(@table_name, column_name, type, options)
588
+ end
589
+
585
590
  # Adds a new index to the table. +column_name+ can be a single Symbol, or
586
591
  # an Array of Symbols. See SchemaStatements#add_index
587
592
  #
@@ -596,6 +601,11 @@ module ActiveRecord
596
601
  @base.add_index(@table_name, column_name, options)
597
602
  end
598
603
 
604
+ # Checks to see if an index exists. See SchemaStatements#index_exists?
605
+ def index_exists?(column_name, options = {})
606
+ @base.index_exists?(@table_name, column_name, options)
607
+ end
608
+
599
609
  # Adds timestamps (created_at and updated_at) columns to the table. See SchemaStatements#add_timestamps
600
610
  # ===== Example
601
611
  # t.timestamps
@@ -24,10 +24,53 @@ module ActiveRecord
24
24
  # Returns an array of indexes for the given table.
25
25
  # def indexes(table_name, name = nil) end
26
26
 
27
+ # Checks to see if an index exists on a table for a given index definition
28
+ #
29
+ # === Examples
30
+ # # Check an index exists
31
+ # index_exists?(:suppliers, :company_id)
32
+ #
33
+ # # Check an index on multiple columns exists
34
+ # index_exists?(:suppliers, [:company_id, :company_type])
35
+ #
36
+ # # Check a unique index exists
37
+ # index_exists?(:suppliers, :company_id, :unique => true)
38
+ #
39
+ # # Check an index with a custom name exists
40
+ # index_exists?(:suppliers, :company_id, :name => "idx_company_id"
41
+ def index_exists?(table_name, column_name, options = {})
42
+ column_names = Array.wrap(column_name)
43
+ index_name = options.key?(:name) ? options[:name].to_s : index_name(table_name, :column => column_names)
44
+ if options[:unique]
45
+ indexes(table_name).any?{ |i| i.unique && i.name == index_name }
46
+ else
47
+ indexes(table_name).any?{ |i| i.name == index_name }
48
+ end
49
+ end
50
+
27
51
  # Returns an array of Column objects for the table specified by +table_name+.
28
52
  # See the concrete implementation for details on the expected parameter values.
29
53
  def columns(table_name, name = nil) end
30
54
 
55
+ # Checks to see if a column exists in a given table.
56
+ #
57
+ # === Examples
58
+ # # Check a column exists
59
+ # column_exists?(:suppliers, :name)
60
+ #
61
+ # # Check a column exists of a particular type
62
+ # column_exists?(:suppliers, :name, :string)
63
+ #
64
+ # # Check a column exists with a specific definition
65
+ # column_exists?(:suppliers, :name, :string, :limit => 100)
66
+ def column_exists?(table_name, column_name, type = nil, options = {})
67
+ columns(table_name).any?{ |c| c.name == column_name.to_s &&
68
+ (!type || c.type == type) &&
69
+ (!options[:limit] || c.limit == options[:limit]) &&
70
+ (!options[:precision] || c.precision == options[:precision]) &&
71
+ (!options[:scale] || c.scale == options[:scale]) }
72
+ end
73
+
31
74
  # Creates a new table with the name +table_name+. +table_name+ may either
32
75
  # be a String or a Symbol.
33
76
  #
@@ -60,10 +103,15 @@ module ActiveRecord
60
103
  # The +options+ hash can include the following keys:
61
104
  # [<tt>:id</tt>]
62
105
  # Whether to automatically add a primary key column. Defaults to true.
63
- # Join tables for +has_and_belongs_to_many+ should set <tt>:id => false</tt>.
106
+ # Join tables for +has_and_belongs_to_many+ should set it to false.
64
107
  # [<tt>:primary_key</tt>]
65
108
  # The name of the primary key, if one is to be added automatically.
66
- # Defaults to +id+.
109
+ # Defaults to +id+. If <tt>:id</tt> is false this option is ignored.
110
+ #
111
+ # Also note that this just sets the primary key in the table. You additionally
112
+ # need to configure the primary key in the model via the +set_primary_key+ macro.
113
+ # Models do NOT auto-detect the primary key from their table definition.
114
+ #
67
115
  # [<tt>:options</tt>]
68
116
  # Any extra options you want appended to the table definition.
69
117
  # [<tt>:temporary</tt>]
@@ -205,6 +253,7 @@ module ActiveRecord
205
253
  # remove_column(:suppliers, :qualification)
206
254
  # remove_columns(:suppliers, :qualification, :experience)
207
255
  def remove_column(table_name, *column_names)
256
+ raise ArgumentError.new("You must specify at least one column name. Example: remove_column(:people, :first_name)") if column_names.empty?
208
257
  column_names.flatten.each do |column_name|
209
258
  execute "ALTER TABLE #{quote_table_name(table_name)} DROP #{quote_column_name(column_name)}"
210
259
  end
@@ -292,7 +341,7 @@ module ActiveRecord
292
341
  @logger.warn("Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{index_name_length} characters. Skipping.")
293
342
  return
294
343
  end
295
- if index_exists?(table_name, index_name, false)
344
+ if index_name_exists?(table_name, index_name, false)
296
345
  @logger.warn("Index name '#{index_name}' on table '#{table_name}' already exists. Skipping.")
297
346
  return
298
347
  end
@@ -313,7 +362,7 @@ module ActiveRecord
313
362
  # remove_index :accounts, :name => :by_branch_party
314
363
  def remove_index(table_name, options = {})
315
364
  index_name = index_name(table_name, options)
316
- unless index_exists?(table_name, index_name, true)
365
+ unless index_name_exists?(table_name, index_name, true)
317
366
  @logger.warn("Index name '#{index_name}' on table '#{table_name}' does not exist. Skipping.")
318
367
  return
319
368
  end
@@ -321,7 +370,7 @@ module ActiveRecord
321
370
  end
322
371
 
323
372
  def remove_index!(table_name, index_name) #:nodoc:
324
- execute "DROP INDEX #{quote_column_name(index_name)} ON #{table_name}"
373
+ execute "DROP INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)}"
325
374
  end
326
375
 
327
376
  # Rename an index.
@@ -350,11 +399,11 @@ module ActiveRecord
350
399
  end
351
400
  end
352
401
 
353
- # Verify the existence of an index.
402
+ # Verify the existence of an index with a given name.
354
403
  #
355
404
  # The default argument is returned if the underlying implementation does not define the indexes method,
356
405
  # as there's no way to determine the correct answer in that case.
357
- def index_exists?(table_name, index_name, default)
406
+ def index_name_exists?(table_name, index_name, default)
358
407
  return default unless respond_to?(:indexes)
359
408
  indexes(table_name).detect { |i| i.name == index_name }
360
409
  end
@@ -15,7 +15,7 @@ require 'active_record/connection_adapters/abstract/database_limits'
15
15
 
16
16
  module ActiveRecord
17
17
  module ConnectionAdapters # :nodoc:
18
- # ActiveRecord supports multiple database systems. AbstractAdapter and
18
+ # Active Record supports multiple database systems. AbstractAdapter and
19
19
  # related classes form the abstraction layer which makes this possible.
20
20
  # An AbstractAdapter represents a connection to a database, and provides an
21
21
  # abstract interface for database-specific functionality such as establishing
@@ -36,14 +36,12 @@ module ActiveRecord
36
36
 
37
37
  define_callbacks :checkout, :checkin
38
38
 
39
- @@row_even = true
40
-
41
39
  def initialize(connection, logger = nil) #:nodoc:
42
40
  @active = nil
43
41
  @connection, @logger = connection, logger
44
- @runtime = 0
45
42
  @query_cache_enabled = false
46
43
  @query_cache = {}
44
+ @instrumenter = ActiveSupport::Notifications.instrumenter
47
45
  end
48
46
 
49
47
  # Returns the human-readable name of the adapter. Use mixed case - one
@@ -59,7 +57,7 @@ module ActiveRecord
59
57
  end
60
58
 
61
59
  # Can this adapter determine the primary key for tables not attached
62
- # to an ActiveRecord class, such as join tables? Backend specific, as
60
+ # to an Active Record class, such as join tables? Backend specific, as
63
61
  # the abstract adapter always returns +false+.
64
62
  def supports_primary_key?
65
63
  false
@@ -92,11 +90,6 @@ module ActiveRecord
92
90
  false
93
91
  end
94
92
 
95
- def reset_runtime #:nodoc:
96
- rt, @runtime = @runtime, 0
97
- rt
98
- end
99
-
100
93
  # QUOTING ==================================================
101
94
 
102
95
  # Override to return the quoted table name. Defaults to column quoting.
@@ -107,7 +100,7 @@ module ActiveRecord
107
100
  # REFERENTIAL INTEGRITY ====================================
108
101
 
109
102
  # Override to turn off referential integrity while executing <tt>&block</tt>.
110
- def disable_referential_integrity(&block)
103
+ def disable_referential_integrity
111
104
  yield
112
105
  end
113
106
 
@@ -142,9 +135,10 @@ module ActiveRecord
142
135
  # this should be overridden by concrete adapters
143
136
  end
144
137
 
145
- # Returns true if its safe to reload the connection between requests for development mode.
138
+ # Returns true if its required to reload the connection between requests for development mode.
139
+ # This is not the case for Ruby/MySQL and it's not necessary for any adapters except SQLite.
146
140
  def requires_reloading?
147
- true
141
+ false
148
142
  end
149
143
 
150
144
  # Checks whether the connection to the database is still active (i.e. not stale).
@@ -198,12 +192,10 @@ module ActiveRecord
198
192
 
199
193
  def log(sql, name)
200
194
  name ||= "SQL"
201
- result = nil
202
- ActiveSupport::Notifications.instrument("sql.active_record",
203
- :sql => sql, :name => name, :connection_id => self.object_id) do
204
- @runtime += Benchmark.ms { result = yield }
195
+ @instrumenter.instrument("sql.active_record",
196
+ :sql => sql, :name => name, :connection_id => object_id) do
197
+ yield
205
198
  end
206
- result
207
199
  rescue Exception => e
208
200
  message = "#{e.class.name}: #{e.message}: #{sql}"
209
201
  @logger.debug message if @logger
@@ -125,7 +125,7 @@ module ActiveRecord
125
125
  # By default, the MysqlAdapter will consider all columns of type <tt>tinyint(1)</tt>
126
126
  # as boolean. If you wish to disable this emulation (which was the default
127
127
  # behavior in versions 0.13.1 and earlier) you can add the following line
128
- # to your environment.rb file:
128
+ # to your application.rb file:
129
129
  #
130
130
  # ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = false
131
131
  cattr_accessor :emulate_booleans
@@ -219,7 +219,7 @@ module ActiveRecord
219
219
 
220
220
  # REFERENTIAL INTEGRITY ====================================
221
221
 
222
- def disable_referential_integrity(&block) #:nodoc:
222
+ def disable_referential_integrity #:nodoc:
223
223
  old = select_value("SELECT @@FOREIGN_KEY_CHECKS")
224
224
 
225
225
  begin