activerecord 3.2.7 → 3.2.8.rc1
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.
- data/CHANGELOG.md +25 -1
- data/lib/active_record.rb +10 -1
- data/lib/active_record/aggregations.rb +0 -3
- data/lib/active_record/associations/builder/collection_association.rb +0 -11
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +0 -10
- data/lib/active_record/persistence.rb +0 -1
- data/lib/active_record/railties/databases.rake +13 -13
- data/lib/active_record/session_store.rb +2 -0
- data/lib/active_record/version.rb +2 -2
- metadata +10 -10
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,28 @@
|
|
1
|
-
## Rails 3.2.
|
1
|
+
## Rails 3.2.8 ##
|
2
|
+
|
3
|
+
* Removes the deprecation of `update_attribute`. *fxn*
|
4
|
+
|
5
|
+
* Reverted the deprecation of `composed_of`. *Rafael Mendonça França*
|
6
|
+
|
7
|
+
* Reverted the deprecation of `*_sql` association options. They will
|
8
|
+
be deprecated in 4.0 instead. *Jon Leighton*
|
9
|
+
|
10
|
+
* Do not eager load AR session store. ActiveRecord::SessionStore depends on the abstract store
|
11
|
+
in Action Pack. Eager loading this class would break client code that eager loads Active Record
|
12
|
+
standalone.
|
13
|
+
Fixes #7160
|
14
|
+
|
15
|
+
*Xavier Noria*
|
16
|
+
|
17
|
+
* Do not set RAILS_ENV to "development" when using `db:test:prepare` and related rake tasks.
|
18
|
+
This was causing the truncation of the development database data when using RSpec.
|
19
|
+
Fixes #7175.
|
20
|
+
|
21
|
+
*Rafael Mendonça França*
|
22
|
+
|
23
|
+
* update_columns added. *Sebastián Martínez*
|
24
|
+
|
25
|
+
## Rails 3.2.7 (Jul 26, 2012) ##
|
2
26
|
|
3
27
|
* `:finder_sql` and `:counter_sql` options on collection associations
|
4
28
|
are deprecated. Please transition to using scopes.
|
data/lib/active_record.rb
CHANGED
@@ -31,6 +31,16 @@ require 'active_record/version'
|
|
31
31
|
module ActiveRecord
|
32
32
|
extend ActiveSupport::Autoload
|
33
33
|
|
34
|
+
# ActiveRecord::SessionStore depends on the abstract store in Action Pack.
|
35
|
+
# Eager loading this class would break client code that eager loads Active
|
36
|
+
# Record standalone.
|
37
|
+
#
|
38
|
+
# Note that the Rails application generator creates an initializer specific
|
39
|
+
# for setting the session store. Thus, albeit in theory this autoload would
|
40
|
+
# not be thread-safe, in practice it is because if the application uses this
|
41
|
+
# session store its autoload happens at boot time.
|
42
|
+
autoload :SessionStore
|
43
|
+
|
34
44
|
eager_autoload do
|
35
45
|
autoload :ActiveRecordError, 'active_record/errors'
|
36
46
|
autoload :ConnectionNotEstablished, 'active_record/errors'
|
@@ -81,7 +91,6 @@ module ActiveRecord
|
|
81
91
|
autoload :SchemaDumper
|
82
92
|
autoload :Scoping
|
83
93
|
autoload :Serialization
|
84
|
-
autoload :SessionStore
|
85
94
|
autoload :Store
|
86
95
|
autoload :Timestamp
|
87
96
|
autoload :Transactions
|
@@ -161,8 +161,6 @@ module ActiveRecord
|
|
161
161
|
#
|
162
162
|
# Customer.where(:balance => Money.new(20, "USD")).all
|
163
163
|
#
|
164
|
-
# Note: +composed_of+ has been deprecated, and will be removed (with no
|
165
|
-
# replacement) in Rails 4.
|
166
164
|
module ClassMethods
|
167
165
|
# Adds reader and writer methods for manipulating a value object:
|
168
166
|
# <tt>composed_of :address</tt> adds <tt>address</tt> and <tt>address=(new_address)</tt> methods.
|
@@ -205,7 +203,6 @@ module ActiveRecord
|
|
205
203
|
# :converter => Proc.new { |ip| ip.is_a?(Integer) ? IPAddr.new(ip, Socket::AF_INET) : IPAddr.new(ip.to_s) }
|
206
204
|
#
|
207
205
|
def composed_of(part_id, options = {})
|
208
|
-
ActiveSupport::Deprecation.warn("composed_of is deprecated, and will be removed in Rails 4. There is no replacement.")
|
209
206
|
options.assert_valid_keys(:class_name, :mapping, :allow_nil, :constructor, :converter)
|
210
207
|
|
211
208
|
name = part_id.id2name
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'active_support/deprecation'
|
2
|
-
|
3
1
|
module ActiveRecord::Associations::Builder
|
4
2
|
class CollectionAssociation < Association #:nodoc:
|
5
3
|
CALLBACKS = [:before_add, :after_add, :before_remove, :after_remove]
|
@@ -21,7 +19,6 @@ module ActiveRecord::Associations::Builder
|
|
21
19
|
end
|
22
20
|
|
23
21
|
def build
|
24
|
-
show_deprecation_warnings
|
25
22
|
wrap_block_extension
|
26
23
|
reflection = super
|
27
24
|
CALLBACKS.each { |callback_name| define_callback(callback_name) }
|
@@ -32,14 +29,6 @@ module ActiveRecord::Associations::Builder
|
|
32
29
|
true
|
33
30
|
end
|
34
31
|
|
35
|
-
def show_deprecation_warnings
|
36
|
-
[:finder_sql, :counter_sql].each do |name|
|
37
|
-
if options.include? name
|
38
|
-
ActiveSupport::Deprecation.warn("The :#{name} association option is deprecated. Please find an alternative (such as using scopes).")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
32
|
private
|
44
33
|
|
45
34
|
def wrap_block_extension
|
@@ -11,16 +11,6 @@ module ActiveRecord::Associations::Builder
|
|
11
11
|
reflection
|
12
12
|
end
|
13
13
|
|
14
|
-
def show_deprecation_warnings
|
15
|
-
super
|
16
|
-
|
17
|
-
[:delete_sql, :insert_sql].each do |name|
|
18
|
-
if options.include? name
|
19
|
-
ActiveSupport::Deprecation.warn("The :#{name} association option is deprecated. Please find an alternative (such as using has_many :through).")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
14
|
private
|
25
15
|
|
26
16
|
def define_destroy_hook
|
@@ -179,7 +179,6 @@ module ActiveRecord
|
|
179
179
|
#
|
180
180
|
def update_attribute(name, value)
|
181
181
|
name = name.to_s
|
182
|
-
ActiveSupport::Deprecation.warn("update_attribute is deprecated and will be removed in Rails 4. If you want to skip mass-assignment protection, callbacks, and modifying updated_at, use update_column. If you do want those things, use update_attributes.")
|
183
182
|
raise ActiveRecordError, "#{name} is marked as readonly" if self.class.readonly_attributes.include?(name)
|
184
183
|
send("#{name}=", value)
|
185
184
|
save(:validate => false)
|
@@ -2,7 +2,7 @@ require 'active_support/core_ext/object/inclusion'
|
|
2
2
|
require 'active_record'
|
3
3
|
|
4
4
|
db_namespace = namespace :db do
|
5
|
-
task :load_config
|
5
|
+
task :load_config do
|
6
6
|
ActiveRecord::Base.configurations = Rails.application.config.database_configuration
|
7
7
|
ActiveRecord::Migrator.migrations_paths = Rails.application.paths['db/migrate'].to_a
|
8
8
|
|
@@ -36,7 +36,7 @@ db_namespace = namespace :db do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
desc 'Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)'
|
39
|
-
task :create => :load_config do
|
39
|
+
task :create => [:load_config, :rails_env] do
|
40
40
|
configs_for_environment.each { |config| create_database(config) }
|
41
41
|
ActiveRecord::Base.establish_connection(configs_for_environment.first)
|
42
42
|
end
|
@@ -134,7 +134,7 @@ db_namespace = namespace :db do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
desc 'Drops the database for the current Rails.env (use db:drop:all to drop all databases)'
|
137
|
-
task :drop => :load_config do
|
137
|
+
task :drop => [:load_config, :rails_env] do
|
138
138
|
configs_for_environment.each { |config| drop_database_and_rescue(config) }
|
139
139
|
end
|
140
140
|
|
@@ -200,8 +200,8 @@ db_namespace = namespace :db do
|
|
200
200
|
end
|
201
201
|
|
202
202
|
desc 'Display status of migrations'
|
203
|
-
task :status => [:environment, :load_config] do
|
204
|
-
config = ActiveRecord::Base.configurations[Rails.env
|
203
|
+
task :status => [:environment, :load_config, :rails_env] do
|
204
|
+
config = ActiveRecord::Base.configurations[Rails.env]
|
205
205
|
ActiveRecord::Base.establish_connection(config)
|
206
206
|
unless ActiveRecord::Base.connection.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name)
|
207
207
|
puts 'Schema migrations table does not exist yet.'
|
@@ -253,8 +253,8 @@ db_namespace = namespace :db do
|
|
253
253
|
end
|
254
254
|
|
255
255
|
# desc "Retrieves the charset for the current environment's database"
|
256
|
-
task :charset => [:environment, :load_config] do
|
257
|
-
config = ActiveRecord::Base.configurations[Rails.env
|
256
|
+
task :charset => [:environment, :load_config, :rails_env] do
|
257
|
+
config = ActiveRecord::Base.configurations[Rails.env]
|
258
258
|
case config['adapter']
|
259
259
|
when /mysql/
|
260
260
|
ActiveRecord::Base.establish_connection(config)
|
@@ -271,8 +271,8 @@ db_namespace = namespace :db do
|
|
271
271
|
end
|
272
272
|
|
273
273
|
# desc "Retrieves the collation for the current environment's database"
|
274
|
-
task :collation => [:environment, :load_config] do
|
275
|
-
config = ActiveRecord::Base.configurations[Rails.env
|
274
|
+
task :collation => [:environment, :load_config, :rails_env] do
|
275
|
+
config = ActiveRecord::Base.configurations[Rails.env]
|
276
276
|
case config['adapter']
|
277
277
|
when /mysql/
|
278
278
|
ActiveRecord::Base.establish_connection(config)
|
@@ -311,7 +311,7 @@ db_namespace = namespace :db do
|
|
311
311
|
|
312
312
|
namespace :fixtures do
|
313
313
|
desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
|
314
|
-
task :load => [:environment, :load_config] do
|
314
|
+
task :load => [:environment, :load_config, :rails_env] do
|
315
315
|
require 'active_record/fixtures'
|
316
316
|
|
317
317
|
ActiveRecord::Base.establish_connection(Rails.env)
|
@@ -349,7 +349,7 @@ db_namespace = namespace :db do
|
|
349
349
|
|
350
350
|
namespace :schema do
|
351
351
|
desc 'Create a db/schema.rb file that can be portably used against any DB supported by AR'
|
352
|
-
task :dump => [:environment, :load_config] do
|
352
|
+
task :dump => [:environment, :load_config, :rails_env] do
|
353
353
|
require 'active_record/schema_dumper'
|
354
354
|
filename = ENV['SCHEMA'] || "#{Rails.root}/db/schema.rb"
|
355
355
|
File.open(filename, "w:utf-8") do |file|
|
@@ -376,7 +376,7 @@ db_namespace = namespace :db do
|
|
376
376
|
|
377
377
|
namespace :structure do
|
378
378
|
desc 'Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql'
|
379
|
-
task :dump => [:environment, :load_config] do
|
379
|
+
task :dump => [:environment, :load_config, :rails_env] do
|
380
380
|
abcs = ActiveRecord::Base.configurations
|
381
381
|
filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, "db", "structure.sql")
|
382
382
|
case abcs[Rails.env]['adapter']
|
@@ -564,7 +564,7 @@ namespace :railties do
|
|
564
564
|
puts "Copied migration #{migration.basename} from #{name}"
|
565
565
|
end
|
566
566
|
|
567
|
-
ActiveRecord::Migration.copy(
|
567
|
+
ActiveRecord::Migration.copy(ActiveRecord::Migrator.migrations_paths.first, railties,
|
568
568
|
:on_skip => on_skip, :on_copy => on_copy)
|
569
569
|
end
|
570
570
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
5
|
-
prerelease:
|
4
|
+
version: 3.2.8.rc1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- David Heinemeier Hansson
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.
|
21
|
+
version: 3.2.8.rc1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.
|
29
|
+
version: 3.2.8.rc1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: activemodel
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - '='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 3.2.
|
37
|
+
version: 3.2.8.rc1
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - '='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 3.2.
|
45
|
+
version: 3.2.8.rc1
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: arel
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,12 +250,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
251
|
none: false
|
252
252
|
requirements:
|
253
|
-
- - ! '
|
253
|
+
- - ! '>'
|
254
254
|
- !ruby/object:Gem::Version
|
255
|
-
version:
|
255
|
+
version: 1.3.1
|
256
256
|
requirements: []
|
257
257
|
rubyforge_project:
|
258
|
-
rubygems_version: 1.8.
|
258
|
+
rubygems_version: 1.8.24
|
259
259
|
signing_key:
|
260
260
|
specification_version: 3
|
261
261
|
summary: Object-relational mapper framework (part of Rails).
|