activerecord 3.0.10 → 3.0.11

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 CHANGED
@@ -1,4 +1,16 @@
1
- * Rails 3.0.10 (unreleased)
1
+ * Rails 3.0.11 (unreleased)
2
+
3
+ * Exceptions from database adapters should not lose their backtrace.
4
+
5
+ * Backport "ActiveRecord::Persistence#touch should not use default_scope" (GH #1519)
6
+
7
+ * Psych errors with poor yaml formatting are proxied. Fixes GH #2645 and
8
+ GH #2731
9
+
10
+ * Fix ActiveRecord#exists? when passsed a nil value
11
+
12
+
13
+ * Rails 3.0.10 (August 16, 2011)
2
14
 
3
15
  * Magic encoding comment added to schema.rb files
4
16
 
@@ -16,8 +28,12 @@ GH #402.
16
28
  * Update `table_exists?` in PG to to always use current search_path or schema
17
29
  if explictly set.
18
30
 
31
+
19
32
  *Rails 3.0.9 (June 16, 2011)*
20
33
 
34
+ *No changes.
35
+
36
+
21
37
  *Rails 3.0.8 (June 7, 2011)*
22
38
 
23
39
  * Fix various problems with using :primary_key and :foreign_key options in conjunction with
@@ -1439,7 +1439,7 @@ module ActiveRecord
1439
1439
 
1440
1440
  if association.nil? || force_reload
1441
1441
  association = association_proxy_class.new(self, reflection)
1442
- retval = force_reload ? reflection.klass.uncached { association.reload } : association.reload
1442
+ retval = force_reload ? reflection.klass.uncached { association.reload } : association.load
1443
1443
  if retval.nil? and association_proxy_class == BelongsToAssociation
1444
1444
  association_instance_set(reflection.name, nil)
1445
1445
  return nil
@@ -112,11 +112,16 @@ module ActiveRecord
112
112
  @target = nil
113
113
  end
114
114
 
115
+ # Loads the \target if not already loaded. Returns +self+ if the \target is present.
116
+ def load
117
+ load_target unless loaded?
118
+ self unless @target.nil?
119
+ end
120
+
115
121
  # Reloads the \target and returns +self+ on success.
116
122
  def reload
117
123
  reset
118
- load_target
119
- self unless @target.nil?
124
+ load
120
125
  end
121
126
 
122
127
  # Has the \target been already \loaded?
@@ -204,7 +204,9 @@ module ActiveRecord
204
204
  rescue Exception => e
205
205
  message = "#{e.class.name}: #{e.message}: #{sql}"
206
206
  @logger.debug message if @logger
207
- raise translate_exception(e, message)
207
+ ex = translate_exception(e, message)
208
+ ex.set_backtrace e.backtrace
209
+ raise ex
208
210
  end
209
211
 
210
212
  def translate_exception(e, message)
@@ -759,10 +759,16 @@ class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash)
759
759
  File.basename(@fixture_path).split(".").first
760
760
  end
761
761
 
762
+ RESCUE_ERRORS = [ ArgumentError ]
763
+
764
+ if defined?(Psych) && defined?(Psych::SyntaxError)
765
+ RESCUE_ERRORS << Psych::SyntaxError
766
+ end
767
+
762
768
  def parse_yaml_string(fixture_content)
763
769
  YAML::load(erb_render(fixture_content))
764
- rescue => error
765
- raise Fixture::FormatError, "a YAML error occurred parsing #{yaml_file_path}. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html\nThe exact error was:\n #{error.class}: #{error}"
770
+ rescue *RESCUE_ERRORS => error
771
+ raise Fixture::FormatError, "a YAML error occurred parsing #{yaml_file_path}. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html\nThe exact error was:\n #{error.class}: #{error}", error.backtrace
766
772
  end
767
773
 
768
774
  def erb_render(fixture_content)
@@ -242,7 +242,7 @@ module ActiveRecord
242
242
 
243
243
  @changed_attributes.except!(*changes.keys)
244
244
  primary_key = self.class.primary_key
245
- self.class.update_all(changes, { primary_key => self[primary_key] }) == 1
245
+ self.class.unscoped.update_all(changes, { primary_key => self[primary_key] }) == 1
246
246
  end
247
247
  end
248
248
 
@@ -85,7 +85,7 @@ namespace :db do
85
85
  "IDENTIFIED BY '#{config['password']}' WITH GRANT OPTION;"
86
86
  ActiveRecord::Base.establish_connection(config.merge(
87
87
  'database' => nil, 'username' => 'root', 'password' => root_password))
88
- ActiveRecord::Base.connection.create_database(config['database'], creation_options)
88
+ ActiveRecord::Base.connection.create_database(config['database'], mysql_creation_options(config))
89
89
  ActiveRecord::Base.connection.execute grant_statement
90
90
  ActiveRecord::Base.establish_connection(config)
91
91
  else
@@ -168,7 +168,9 @@ module ActiveRecord
168
168
  # Person.exists?(:name => "David")
169
169
  # Person.exists?(['name LIKE ?', "%#{query}%"])
170
170
  # Person.exists?
171
- def exists?(id = nil)
171
+ def exists?(id = false)
172
+ return false if id.nil?
173
+
172
174
  id = id.id if ActiveRecord::Base === id
173
175
 
174
176
  join_dependency = construct_join_dependency_for_association_find
@@ -2,7 +2,7 @@ module ActiveRecord
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 10
5
+ TINY = 11
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 10
10
- version: 3.0.10
9
+ - 11
10
+ version: 3.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heinemeier Hansson
@@ -15,44 +15,45 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-16 00:00:00 Z
18
+ date: 2011-11-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
22
+ type: :runtime
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - "="
27
28
  - !ruby/object:Gem::Version
28
- hash: 19
29
+ hash: 17
29
30
  segments:
30
31
  - 3
31
32
  - 0
32
- - 10
33
- version: 3.0.10
34
- type: :runtime
35
- version_requirements: *id001
33
+ - 11
34
+ version: 3.0.11
35
+ requirement: *id001
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activemodel
38
+ type: :runtime
38
39
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
41
  none: false
41
42
  requirements:
42
43
  - - "="
43
44
  - !ruby/object:Gem::Version
44
- hash: 19
45
+ hash: 17
45
46
  segments:
46
47
  - 3
47
48
  - 0
48
- - 10
49
- version: 3.0.10
50
- type: :runtime
51
- version_requirements: *id002
49
+ - 11
50
+ version: 3.0.11
51
+ requirement: *id002
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: arel
54
+ type: :runtime
54
55
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
57
  none: false
57
58
  requirements:
58
59
  - - ~>
@@ -63,12 +64,12 @@ dependencies:
63
64
  - 0
64
65
  - 10
65
66
  version: 2.0.10
66
- type: :runtime
67
- version_requirements: *id003
67
+ requirement: *id003
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: tzinfo
70
+ type: :runtime
70
71
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
72
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
73
  none: false
73
74
  requirements:
74
75
  - - ~>
@@ -79,8 +80,7 @@ dependencies:
79
80
  - 3
80
81
  - 23
81
82
  version: 0.3.23
82
- type: :runtime
83
- version_requirements: *id004
83
+ requirement: *id004
84
84
  description: Databases on Rails. Build a persistent domain model by mapping database tables to Ruby classes. Strong conventions for associations, validations, aggregations, migrations, and testing come baked-in.
85
85
  email: david@loudthinking.com
86
86
  executables: []
@@ -92,98 +92,98 @@ extra_rdoc_files:
92
92
  files:
93
93
  - CHANGELOG
94
94
  - README.rdoc
95
- - examples/associations.png
96
95
  - examples/performance.rb
97
96
  - examples/simple.rb
98
- - lib/active_record/aggregations.rb
99
- - lib/active_record/association_preload.rb
100
- - lib/active_record/associations/association_collection.rb
101
- - lib/active_record/associations/association_proxy.rb
102
- - lib/active_record/associations/belongs_to_association.rb
103
- - lib/active_record/associations/belongs_to_polymorphic_association.rb
104
- - lib/active_record/associations/has_and_belongs_to_many_association.rb
105
- - lib/active_record/associations/has_many_association.rb
106
- - lib/active_record/associations/has_many_through_association.rb
107
- - lib/active_record/associations/has_one_association.rb
108
- - lib/active_record/associations/has_one_through_association.rb
109
- - lib/active_record/associations/through_association_scope.rb
97
+ - examples/associations.png
98
+ - lib/active_record/locale/en.yml
110
99
  - lib/active_record/associations.rb
111
- - lib/active_record/attribute_methods/before_type_cast.rb
100
+ - lib/active_record/relation.rb
101
+ - lib/active_record/migration.rb
102
+ - lib/active_record/railties/jdbcmysql_error.rb
103
+ - lib/active_record/railties/databases.rake
104
+ - lib/active_record/railties/controller_runtime.rb
105
+ - lib/active_record/nested_attributes.rb
106
+ - lib/active_record/dynamic_finder_match.rb
107
+ - lib/active_record/attribute_methods.rb
108
+ - lib/active_record/relation/spawn_methods.rb
109
+ - lib/active_record/relation/predicate_builder.rb
110
+ - lib/active_record/relation/batches.rb
111
+ - lib/active_record/relation/calculations.rb
112
+ - lib/active_record/relation/finder_methods.rb
113
+ - lib/active_record/relation/query_methods.rb
114
+ - lib/active_record/schema.rb
115
+ - lib/active_record/named_scope.rb
116
+ - lib/active_record/schema_dumper.rb
117
+ - lib/active_record/errors.rb
118
+ - lib/active_record/test_case.rb
119
+ - lib/active_record/fixtures.rb
112
120
  - lib/active_record/attribute_methods/dirty.rb
113
121
  - lib/active_record/attribute_methods/primary_key.rb
114
- - lib/active_record/attribute_methods/query.rb
115
- - lib/active_record/attribute_methods/read.rb
116
122
  - lib/active_record/attribute_methods/time_zone_conversion.rb
123
+ - lib/active_record/attribute_methods/query.rb
117
124
  - lib/active_record/attribute_methods/write.rb
118
- - lib/active_record/attribute_methods.rb
125
+ - lib/active_record/attribute_methods/read.rb
126
+ - lib/active_record/attribute_methods/before_type_cast.rb
127
+ - lib/active_record/aggregations.rb
128
+ - lib/active_record/locking/pessimistic.rb
129
+ - lib/active_record/locking/optimistic.rb
130
+ - lib/active_record/observer.rb
131
+ - lib/active_record/log_subscriber.rb
132
+ - lib/active_record/reflection.rb
133
+ - lib/active_record/counter_cache.rb
134
+ - lib/active_record/version.rb
135
+ - lib/active_record/transactions.rb
136
+ - lib/active_record/serialization.rb
137
+ - lib/active_record/timestamp.rb
138
+ - lib/active_record/railtie.rb
139
+ - lib/active_record/session_store.rb
140
+ - lib/active_record/persistence.rb
141
+ - lib/active_record/validations.rb
142
+ - lib/active_record/callbacks.rb
119
143
  - lib/active_record/autosave_association.rb
120
144
  - lib/active_record/base.rb
121
- - lib/active_record/callbacks.rb
122
- - lib/active_record/connection_adapters/abstract/connection_pool.rb
123
- - lib/active_record/connection_adapters/abstract/connection_specification.rb
145
+ - lib/active_record/connection_adapters/postgresql_adapter.rb
146
+ - lib/active_record/connection_adapters/abstract/quoting.rb
147
+ - lib/active_record/connection_adapters/abstract/schema_statements.rb
124
148
  - lib/active_record/connection_adapters/abstract/database_limits.rb
149
+ - lib/active_record/connection_adapters/abstract/schema_definitions.rb
125
150
  - lib/active_record/connection_adapters/abstract/database_statements.rb
151
+ - lib/active_record/connection_adapters/abstract/connection_specification.rb
152
+ - lib/active_record/connection_adapters/abstract/connection_pool.rb
126
153
  - lib/active_record/connection_adapters/abstract/query_cache.rb
127
- - lib/active_record/connection_adapters/abstract/quoting.rb
128
- - lib/active_record/connection_adapters/abstract/schema_definitions.rb
129
- - lib/active_record/connection_adapters/abstract/schema_statements.rb
130
154
  - lib/active_record/connection_adapters/abstract_adapter.rb
131
- - lib/active_record/connection_adapters/mysql_adapter.rb
132
- - lib/active_record/connection_adapters/postgresql_adapter.rb
133
155
  - lib/active_record/connection_adapters/sqlite3_adapter.rb
156
+ - lib/active_record/connection_adapters/mysql_adapter.rb
134
157
  - lib/active_record/connection_adapters/sqlite_adapter.rb
135
- - lib/active_record/counter_cache.rb
136
- - lib/active_record/dynamic_finder_match.rb
158
+ - lib/active_record/association_preload.rb
137
159
  - lib/active_record/dynamic_scope_match.rb
138
- - lib/active_record/errors.rb
139
- - lib/active_record/fixtures.rb
140
- - lib/active_record/locale/en.yml
141
- - lib/active_record/locking/optimistic.rb
142
- - lib/active_record/locking/pessimistic.rb
143
- - lib/active_record/log_subscriber.rb
144
- - lib/active_record/migration.rb
145
- - lib/active_record/named_scope.rb
146
- - lib/active_record/nested_attributes.rb
147
- - lib/active_record/observer.rb
148
- - lib/active_record/persistence.rb
160
+ - lib/active_record/validations/uniqueness.rb
161
+ - lib/active_record/validations/associated.rb
149
162
  - lib/active_record/query_cache.rb
150
- - lib/active_record/railtie.rb
151
- - lib/active_record/railties/controller_runtime.rb
152
- - lib/active_record/railties/databases.rake
153
- - lib/active_record/railties/jdbcmysql_error.rb
154
- - lib/active_record/reflection.rb
155
- - lib/active_record/relation/batches.rb
156
- - lib/active_record/relation/calculations.rb
157
- - lib/active_record/relation/finder_methods.rb
158
- - lib/active_record/relation/predicate_builder.rb
159
- - lib/active_record/relation/query_methods.rb
160
- - lib/active_record/relation/spawn_methods.rb
161
- - lib/active_record/relation.rb
162
- - lib/active_record/schema.rb
163
- - lib/active_record/schema_dumper.rb
164
- - lib/active_record/serialization.rb
165
163
  - lib/active_record/serializers/xml_serializer.rb
166
- - lib/active_record/session_store.rb
167
- - lib/active_record/test_case.rb
168
- - lib/active_record/timestamp.rb
169
- - lib/active_record/transactions.rb
170
- - lib/active_record/validations/associated.rb
171
- - lib/active_record/validations/uniqueness.rb
172
- - lib/active_record/validations.rb
173
- - lib/active_record/version.rb
174
- - lib/active_record.rb
164
+ - lib/active_record/associations/has_many_through_association.rb
165
+ - lib/active_record/associations/belongs_to_polymorphic_association.rb
166
+ - lib/active_record/associations/belongs_to_association.rb
167
+ - lib/active_record/associations/has_one_through_association.rb
168
+ - lib/active_record/associations/association_proxy.rb
169
+ - lib/active_record/associations/has_many_association.rb
170
+ - lib/active_record/associations/has_and_belongs_to_many_association.rb
171
+ - lib/active_record/associations/has_one_association.rb
172
+ - lib/active_record/associations/through_association_scope.rb
173
+ - lib/active_record/associations/association_collection.rb
174
+ - lib/rails/generators/active_record/migration.rb
175
+ - lib/rails/generators/active_record/session_migration/session_migration_generator.rb
176
+ - lib/rails/generators/active_record/session_migration/templates/migration.rb
175
177
  - lib/rails/generators/active_record/migration/migration_generator.rb
176
178
  - lib/rails/generators/active_record/migration/templates/migration.rb
177
- - lib/rails/generators/active_record/migration.rb
178
179
  - lib/rails/generators/active_record/model/model_generator.rb
179
180
  - lib/rails/generators/active_record/model/templates/migration.rb
180
- - lib/rails/generators/active_record/model/templates/model.rb
181
181
  - lib/rails/generators/active_record/model/templates/module.rb
182
- - lib/rails/generators/active_record/observer/observer_generator.rb
182
+ - lib/rails/generators/active_record/model/templates/model.rb
183
183
  - lib/rails/generators/active_record/observer/templates/observer.rb
184
- - lib/rails/generators/active_record/session_migration/session_migration_generator.rb
185
- - lib/rails/generators/active_record/session_migration/templates/migration.rb
184
+ - lib/rails/generators/active_record/observer/observer_generator.rb
186
185
  - lib/rails/generators/active_record.rb
186
+ - lib/active_record.rb
187
187
  homepage: http://www.rubyonrails.org
188
188
  licenses: []
189
189
 
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  requirements: []
217
217
 
218
218
  rubyforge_project: activerecord
219
- rubygems_version: 1.8.8
219
+ rubygems_version: 1.8.6
220
220
  signing_key:
221
221
  specification_version: 3
222
222
  summary: Object-relational mapper framework (part of Rails).