activerecord 2.3.11 → 2.3.12
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/Rakefile +5 -7
- data/lib/active_record/associations/association_collection.rb +1 -1
- data/lib/active_record/base.rb +1 -1
- data/lib/active_record/version.rb +1 -1
- data/test/cases/associations/has_many_associations_test.rb +9 -0
- data/test/fixtures/fixture_database.sqlite3 +0 -0
- data/test/fixtures/fixture_database_2.sqlite3 +0 -0
- metadata +10 -14
- data/test/fixtures/fixture_database.sqlite +0 -0
- data/test/fixtures/fixture_database_2.sqlite +0 -0
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'rake/testtask'
|
4
|
-
require '
|
4
|
+
require 'rdoc/task'
|
5
5
|
require 'rake/packagetask'
|
6
|
-
require '
|
6
|
+
require 'rubygems/package_task'
|
7
7
|
|
8
8
|
require File.join(File.dirname(__FILE__), 'lib', 'active_record', 'version')
|
9
9
|
require File.expand_path(File.dirname(__FILE__)) + "/test/config"
|
@@ -157,7 +157,7 @@ task :rebuild_frontbase_databases => 'frontbase:rebuild_databases'
|
|
157
157
|
|
158
158
|
# Generate the RDoc documentation
|
159
159
|
|
160
|
-
|
160
|
+
RDoc::Task.new { |rdoc|
|
161
161
|
rdoc.rdoc_dir = 'doc'
|
162
162
|
rdoc.title = "Active Record -- Object-relation mapping put on rails"
|
163
163
|
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
@@ -192,16 +192,14 @@ spec = Gem::Specification.new do |s|
|
|
192
192
|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
193
193
|
end
|
194
194
|
|
195
|
-
s.add_dependency('activesupport', '= 2.3.
|
195
|
+
s.add_dependency('activesupport', '= 2.3.12' + PKG_BUILD)
|
196
196
|
|
197
197
|
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite"
|
198
198
|
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite"
|
199
199
|
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite3"
|
200
200
|
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite3"
|
201
201
|
s.require_path = 'lib'
|
202
|
-
s.autorequire = 'active_record'
|
203
202
|
|
204
|
-
s.has_rdoc = true
|
205
203
|
s.extra_rdoc_files = %w( README )
|
206
204
|
s.rdoc_options.concat ['--main', 'README']
|
207
205
|
|
@@ -211,7 +209,7 @@ spec = Gem::Specification.new do |s|
|
|
211
209
|
s.rubyforge_project = "activerecord"
|
212
210
|
end
|
213
211
|
|
214
|
-
|
212
|
+
Gem::PackageTask.new(spec) do |p|
|
215
213
|
p.gem_spec = spec
|
216
214
|
p.need_tar = true
|
217
215
|
p.need_zip = true
|
@@ -381,7 +381,7 @@ module ActiveRecord
|
|
381
381
|
when /^find_or_create_by_(.*)$/
|
382
382
|
rest = $1
|
383
383
|
find_args = pull_finder_args_from(DynamicFinderMatch.match(method).attribute_names, *args)
|
384
|
-
return send("find_by_#{rest}", find_args) ||
|
384
|
+
return send("find_by_#{rest}", *find_args) ||
|
385
385
|
method_missing("create_by_#{rest}", *args, &block)
|
386
386
|
when /^create_by_(.*)$/
|
387
387
|
return create($1.split('_and_').zip(args).inject({}) { |h,kv| k,v=kv ; h[k] = v ; h }, &block)
|
data/lib/active_record/base.rb
CHANGED
@@ -1286,7 +1286,7 @@ module ActiveRecord #:nodoc:
|
|
1286
1286
|
|
1287
1287
|
# Turns the +table_name+ back into a class name following the reverse rules of +table_name+.
|
1288
1288
|
def class_name(table_name = table_name) # :nodoc:
|
1289
|
-
ActiveSupport::Deprecation.warn("ActiveRecord::Base#class_name is deprecated and will be removed in Rails
|
1289
|
+
ActiveSupport::Deprecation.warn("ActiveRecord::Base#class_name is deprecated and will be removed in Rails 3.", caller)
|
1290
1290
|
|
1291
1291
|
# remove any prefix and/or suffix from the table name
|
1292
1292
|
class_name = table_name[table_name_prefix.length..-(table_name_suffix.length + 1)].camelize
|
@@ -82,6 +82,15 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|
82
82
|
assert_equal 4, post.comments.length
|
83
83
|
end
|
84
84
|
|
85
|
+
def test_find_or_create_by_with_same_parameters_creates_a_single_record
|
86
|
+
author = Author.first
|
87
|
+
assert_difference "Post.count", +1 do
|
88
|
+
2.times do
|
89
|
+
author.posts.find_or_create_by_body_and_title('one', 'two')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
85
94
|
def test_find_or_create_by_with_block
|
86
95
|
post = Post.create! :title => 'test_find_or_create_by_with_additional_parameters', :body => 'this is the body'
|
87
96
|
comment = post.comments.find_or_create_by_body('other test comment body') { |comment| comment.type = 'test' }
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 12
|
10
|
+
version: 2.3.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Heinemeier Hansson
|
14
|
-
autorequire:
|
14
|
+
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-06-08 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: activesupport
|
@@ -26,12 +25,12 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - "="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
28
|
+
hash: 27
|
30
29
|
segments:
|
31
30
|
- 2
|
32
31
|
- 3
|
33
|
-
-
|
34
|
-
version: 2.3.
|
32
|
+
- 12
|
33
|
+
version: 2.3.12
|
35
34
|
type: :runtime
|
36
35
|
version_requirements: *id001
|
37
36
|
description: Implements the ActiveRecord pattern (Fowler, PoEAA) for ORM. It ties database tables and classes together for business objects, like Customer or Subscription, that can find, save, and destroy themselves without resorting to manual SQL.
|
@@ -239,9 +238,7 @@ files:
|
|
239
238
|
- test/fixtures/edges.yml
|
240
239
|
- test/fixtures/entrants.yml
|
241
240
|
- test/fixtures/faces.yml
|
242
|
-
- test/fixtures/fixture_database.sqlite
|
243
241
|
- test/fixtures/fixture_database.sqlite3
|
244
|
-
- test/fixtures/fixture_database_2.sqlite
|
245
242
|
- test/fixtures/fixture_database_2.sqlite3
|
246
243
|
- test/fixtures/fk_test_has_fk.yml
|
247
244
|
- test/fixtures/fk_test_has_pk.yml
|
@@ -401,7 +398,6 @@ files:
|
|
401
398
|
- test/schema/sqlite_specific_schema.rb
|
402
399
|
- examples/associations.png
|
403
400
|
- examples/performance.rb
|
404
|
-
has_rdoc: true
|
405
401
|
homepage: http://www.rubyonrails.org
|
406
402
|
licenses: []
|
407
403
|
|
@@ -432,7 +428,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
432
428
|
requirements: []
|
433
429
|
|
434
430
|
rubyforge_project: activerecord
|
435
|
-
rubygems_version: 1.
|
431
|
+
rubygems_version: 1.8.2
|
436
432
|
signing_key:
|
437
433
|
specification_version: 3
|
438
434
|
summary: Implements the ActiveRecord pattern for ORM.
|
Binary file
|
Binary file
|