activerecord 3.1.0 → 3.1.1.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 +36 -1
- data/lib/active_record.rb +0 -7
- data/lib/active_record/associations/alias_tracker.rb +12 -6
- data/lib/active_record/associations/belongs_to_association.rb +4 -0
- data/lib/active_record/associations/collection_association.rb +7 -3
- data/lib/active_record/associations/collection_proxy.rb +1 -1
- data/lib/active_record/associations/through_association.rb +1 -1
- data/lib/active_record/base.rb +2 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +1 -1
- data/lib/active_record/connection_adapters/mysql_adapter.rb +36 -4
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +47 -6
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +57 -5
- data/lib/active_record/connection_adapters/statement_pool.rb +40 -0
- data/lib/active_record/fixtures.rb +370 -374
- data/lib/active_record/migration/command_recorder.rb +1 -1
- data/lib/active_record/railties/databases.rake +7 -5
- data/lib/active_record/reflection.rb +1 -1
- data/lib/active_record/relation/batches.rb +1 -1
- data/lib/active_record/relation/calculations.rb +1 -0
- data/lib/active_record/relation/finder_methods.rb +9 -3
- data/lib/active_record/relation/query_methods.rb +2 -7
- data/lib/active_record/version.rb +2 -2
- metadata +24 -16
@@ -203,11 +203,13 @@ db_namespace = namespace :db do
|
|
203
203
|
end
|
204
204
|
db_list = ActiveRecord::Base.connection.select_values("SELECT version FROM #{ActiveRecord::Migrator.schema_migrations_table_name}")
|
205
205
|
file_list = []
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
206
|
+
ActiveRecord::Migrator.migrations_paths.each do |path|
|
207
|
+
Dir.foreach(path) do |file|
|
208
|
+
# only files matching "20091231235959_some_name.rb" pattern
|
209
|
+
if match_data = /^(\d{14})_(.+)\.rb$/.match(file)
|
210
|
+
status = db_list.delete(match_data[1]) ? 'up' : 'down'
|
211
|
+
file_list << [status, match_data[1], match_data[2].humanize]
|
212
|
+
end
|
211
213
|
end
|
212
214
|
end
|
213
215
|
db_list.map! do |version|
|
@@ -62,7 +62,7 @@ module ActiveRecord
|
|
62
62
|
start = options.delete(:start).to_i
|
63
63
|
batch_size = options.delete(:batch_size) || 1000
|
64
64
|
|
65
|
-
relation = relation.
|
65
|
+
relation = relation.reorder(batch_order).limit(batch_size)
|
66
66
|
records = relation.where(table[primary_key].gteq(start)).all
|
67
67
|
|
68
68
|
while records.any?
|
@@ -114,7 +114,7 @@ module ActiveRecord
|
|
114
114
|
def first(*args)
|
115
115
|
if args.any?
|
116
116
|
if args.first.kind_of?(Integer) || (loaded? && !args.first.kind_of?(Hash))
|
117
|
-
|
117
|
+
limit(*args).to_a
|
118
118
|
else
|
119
119
|
apply_finder_options(args.first).first
|
120
120
|
end
|
@@ -134,7 +134,11 @@ module ActiveRecord
|
|
134
134
|
def last(*args)
|
135
135
|
if args.any?
|
136
136
|
if args.first.kind_of?(Integer) || (loaded? && !args.first.kind_of?(Hash))
|
137
|
-
|
137
|
+
if order_values.empty? && reorder_value.nil?
|
138
|
+
order("#{primary_key} DESC").limit(*args).reverse
|
139
|
+
else
|
140
|
+
to_a.last(*args)
|
141
|
+
end
|
138
142
|
else
|
139
143
|
apply_finder_options(args.first).last
|
140
144
|
end
|
@@ -180,7 +184,9 @@ module ActiveRecord
|
|
180
184
|
# Person.exists?(:name => "David")
|
181
185
|
# Person.exists?(['name LIKE ?', "%#{query}%"])
|
182
186
|
# Person.exists?
|
183
|
-
def exists?(id =
|
187
|
+
def exists?(id = false)
|
188
|
+
return false if id.nil?
|
189
|
+
|
184
190
|
id = id.id if ActiveRecord::Base === id
|
185
191
|
|
186
192
|
join_dependency = construct_join_dependency_for_association_find
|
@@ -254,12 +254,12 @@ module ActiveRecord
|
|
254
254
|
|
255
255
|
association_joins = buckets['association_join'] || []
|
256
256
|
stashed_association_joins = buckets['stashed_join'] || []
|
257
|
-
join_nodes = buckets['join_node'] || []
|
257
|
+
join_nodes = (buckets['join_node'] || []).uniq
|
258
258
|
string_joins = (buckets['string_join'] || []).map { |x|
|
259
259
|
x.strip
|
260
260
|
}.uniq
|
261
261
|
|
262
|
-
join_list = custom_join_ast(manager, string_joins)
|
262
|
+
join_list = join_nodes + custom_join_ast(manager, string_joins)
|
263
263
|
|
264
264
|
join_dependency = ActiveRecord::Associations::JoinDependency.new(
|
265
265
|
@klass,
|
@@ -267,10 +267,6 @@ module ActiveRecord
|
|
267
267
|
join_list
|
268
268
|
)
|
269
269
|
|
270
|
-
join_nodes.each do |join|
|
271
|
-
join_dependency.alias_tracker.aliased_name_for(join.left.name.downcase)
|
272
|
-
end
|
273
|
-
|
274
270
|
join_dependency.graft(*stashed_association_joins)
|
275
271
|
|
276
272
|
@implicit_readonly = true unless association_joins.empty? && stashed_association_joins.empty?
|
@@ -280,7 +276,6 @@ module ActiveRecord
|
|
280
276
|
association.join_to(manager)
|
281
277
|
end
|
282
278
|
|
283
|
-
manager.join_sources.concat join_nodes.uniq
|
284
279
|
manager.join_sources.concat join_list
|
285
280
|
|
286
281
|
manager
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 977940594
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
|
9
|
+
- 1
|
10
|
+
- rc1
|
11
|
+
version: 3.1.1.rc1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- David Heinemeier Hansson
|
@@ -15,7 +16,8 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-09-14 00:00:00 -07:00
|
20
|
+
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: activesupport
|
@@ -25,12 +27,13 @@ dependencies:
|
|
25
27
|
requirements:
|
26
28
|
- - "="
|
27
29
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
30
|
+
hash: 977940594
|
29
31
|
segments:
|
30
32
|
- 3
|
31
33
|
- 1
|
32
|
-
-
|
33
|
-
|
34
|
+
- 1
|
35
|
+
- rc1
|
36
|
+
version: 3.1.1.rc1
|
34
37
|
type: :runtime
|
35
38
|
version_requirements: *id001
|
36
39
|
- !ruby/object:Gem::Dependency
|
@@ -41,12 +44,13 @@ dependencies:
|
|
41
44
|
requirements:
|
42
45
|
- - "="
|
43
46
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
47
|
+
hash: 977940594
|
45
48
|
segments:
|
46
49
|
- 3
|
47
50
|
- 1
|
48
|
-
-
|
49
|
-
|
51
|
+
- 1
|
52
|
+
- rc1
|
53
|
+
version: 3.1.1.rc1
|
50
54
|
type: :runtime
|
51
55
|
version_requirements: *id002
|
52
56
|
- !ruby/object:Gem::Dependency
|
@@ -161,6 +165,7 @@ files:
|
|
161
165
|
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
162
166
|
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
163
167
|
- lib/active_record/connection_adapters/sqlite_adapter.rb
|
168
|
+
- lib/active_record/connection_adapters/statement_pool.rb
|
164
169
|
- lib/active_record/counter_cache.rb
|
165
170
|
- lib/active_record/dynamic_finder_match.rb
|
166
171
|
- lib/active_record/dynamic_scope_match.rb
|
@@ -217,6 +222,7 @@ files:
|
|
217
222
|
- lib/rails/generators/active_record/session_migration/session_migration_generator.rb
|
218
223
|
- lib/rails/generators/active_record/session_migration/templates/migration.rb
|
219
224
|
- lib/rails/generators/active_record.rb
|
225
|
+
has_rdoc: true
|
220
226
|
homepage: http://www.rubyonrails.org
|
221
227
|
licenses: []
|
222
228
|
|
@@ -240,16 +246,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
247
|
none: false
|
242
248
|
requirements:
|
243
|
-
- - "
|
249
|
+
- - ">"
|
244
250
|
- !ruby/object:Gem::Version
|
245
|
-
hash:
|
251
|
+
hash: 25
|
246
252
|
segments:
|
247
|
-
-
|
248
|
-
|
253
|
+
- 1
|
254
|
+
- 3
|
255
|
+
- 1
|
256
|
+
version: 1.3.1
|
249
257
|
requirements: []
|
250
258
|
|
251
259
|
rubyforge_project:
|
252
|
-
rubygems_version: 1.
|
260
|
+
rubygems_version: 1.3.7
|
253
261
|
signing_key:
|
254
262
|
specification_version: 3
|
255
263
|
summary: Object-relational mapper framework (part of Rails).
|