mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-07 09:48:50 +01:00
upgrade to rails 2.3.12 and fix deprecation warning and fix some version numbers of gems used for testing
This commit is contained in:
parent
a3c5920a2b
commit
ceda51b5bf
34 changed files with 2451 additions and 11266 deletions
12
vendor/rails/activerecord/Rakefile
vendored
12
vendor/rails/activerecord/Rakefile
vendored
|
|
@ -1,9 +1,9 @@
|
|||
require 'rubygems'
|
||||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
require 'rake/rdoctask'
|
||||
require 'rdoc/task'
|
||||
require 'rake/packagetask'
|
||||
require 'rake/gempackagetask'
|
||||
require 'rubygems/package_task'
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'lib', 'active_record', 'version')
|
||||
require File.expand_path(File.dirname(__FILE__)) + "/test/config"
|
||||
|
|
@ -157,7 +157,7 @@ task :rebuild_frontbase_databases => 'frontbase:rebuild_databases'
|
|||
|
||||
# Generate the RDoc documentation
|
||||
|
||||
Rake::RDocTask.new { |rdoc|
|
||||
RDoc::Task.new { |rdoc|
|
||||
rdoc.rdoc_dir = 'doc'
|
||||
rdoc.title = "Active Record -- Object-relation mapping put on rails"
|
||||
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
||||
|
|
@ -192,16 +192,14 @@ spec = Gem::Specification.new do |s|
|
|||
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
||||
end
|
||||
|
||||
s.add_dependency('activesupport', '= 2.3.11' + PKG_BUILD)
|
||||
s.add_dependency('activesupport', '= 2.3.12' + PKG_BUILD)
|
||||
|
||||
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite"
|
||||
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite"
|
||||
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite3"
|
||||
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite3"
|
||||
s.require_path = 'lib'
|
||||
s.autorequire = 'active_record'
|
||||
|
||||
s.has_rdoc = true
|
||||
s.extra_rdoc_files = %w( README )
|
||||
s.rdoc_options.concat ['--main', 'README']
|
||||
|
||||
|
|
@ -211,7 +209,7 @@ spec = Gem::Specification.new do |s|
|
|||
s.rubyforge_project = "activerecord"
|
||||
end
|
||||
|
||||
Rake::GemPackageTask.new(spec) do |p|
|
||||
Gem::PackageTask.new(spec) do |p|
|
||||
p.gem_spec = spec
|
||||
p.need_tar = true
|
||||
p.need_zip = true
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ module ActiveRecord
|
|||
when /^find_or_create_by_(.*)$/
|
||||
rest = $1
|
||||
find_args = pull_finder_args_from(DynamicFinderMatch.match(method).attribute_names, *args)
|
||||
return send("find_by_#{rest}", find_args) ||
|
||||
return send("find_by_#{rest}", *find_args) ||
|
||||
method_missing("create_by_#{rest}", *args, &block)
|
||||
when /^create_by_(.*)$/
|
||||
return create($1.split('_and_').zip(args).inject({}) { |h,kv| k,v=kv ; h[k] = v ; h }, &block)
|
||||
|
|
|
|||
|
|
@ -1286,7 +1286,7 @@ module ActiveRecord #:nodoc:
|
|||
|
||||
# Turns the +table_name+ back into a class name following the reverse rules of +table_name+.
|
||||
def class_name(table_name = table_name) # :nodoc:
|
||||
ActiveSupport::Deprecation.warn("ActiveRecord::Base#class_name is deprecated and will be removed in Rails 2.3.9.", caller)
|
||||
ActiveSupport::Deprecation.warn("ActiveRecord::Base#class_name is deprecated and will be removed in Rails 3.", caller)
|
||||
|
||||
# remove any prefix and/or suffix from the table name
|
||||
class_name = table_name[table_name_prefix.length..-(table_name_suffix.length + 1)].camelize
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module ActiveRecord
|
|||
module VERSION #:nodoc:
|
||||
MAJOR = 2
|
||||
MINOR = 3
|
||||
TINY = 11
|
||||
TINY = 12
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -82,6 +82,15 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
|||
assert_equal 4, post.comments.length
|
||||
end
|
||||
|
||||
def test_find_or_create_by_with_same_parameters_creates_a_single_record
|
||||
author = Author.first
|
||||
assert_difference "Post.count", +1 do
|
||||
2.times do
|
||||
author.posts.find_or_create_by_body_and_title('one', 'two')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_find_or_create_by_with_block
|
||||
post = Post.create! :title => 'test_find_or_create_by_with_additional_parameters', :body => 'this is the body'
|
||||
comment = post.comments.find_or_create_by_body('other test comment body') { |comment| comment.type = 'test' }
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue