diff options
author | Xavier Noria <fxn@hashref.com> | 2010-05-27 10:57:05 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-05-27 10:57:05 +0200 |
commit | ddec74fb3ab66528ca98ff37ca9b5f4227fdd2e3 (patch) | |
tree | c58ac9162487bdca68342fb2d30730ccfd926378 /activerecord | |
parent | 96e2094b8b634e4af0d9d3c8a1db9bbb7023a4a7 (diff) | |
parent | e02db06ece7aeecec7c37f5b0e3de7d65c8684e6 (diff) | |
download | rails-ddec74fb3ab66528ca98ff37ca9b5f4227fdd2e3.tar.gz rails-ddec74fb3ab66528ca98ff37ca9b5f4227fdd2e3.tar.bz2 rails-ddec74fb3ab66528ca98ff37ca9b5f4227fdd2e3.zip |
Merge remote branch 'rails/master'
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/association_preload.rb | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 4 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 5 | ||||
-rw-r--r-- | activerecord/test/cases/validations_test.rb | 12 | ||||
-rw-r--r-- | activerecord/test/models/reply.rb | 6 |
6 files changed, 14 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb index 95bbaf00cf..1f5217191c 100644 --- a/activerecord/lib/active_record/association_preload.rb +++ b/activerecord/lib/active_record/association_preload.rb @@ -378,7 +378,7 @@ module ActiveRecord def interpolate_sql_for_preload(sql) - instance_eval("%@#{sql.gsub('@', '\@')}@") + instance_eval("%@#{sql.gsub('@', '\@')}@", __FILE__, __LINE__) end def append_conditions(reflection, preload_options) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f23d881c7b..5b0ba86308 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1461,7 +1461,7 @@ module ActiveRecord before_destroy(method_name) module_eval( - "#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name}) && #{reflection.class_name}.respond_to?(:attr_readonly)" + "#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name}) && #{reflection.class_name}.respond_to?(:attr_readonly)", __FILE__, __LINE__ ) end @@ -2130,7 +2130,7 @@ module ActiveRecord end def interpolate_sql(sql) - instance_eval("%@#{sql.gsub('@', '\@')}@") + instance_eval("%@#{sql.gsub('@', '\@')}@", __FILE__, __LINE__) end end end diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 1b76f357e3..aa2826fb33 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1786,7 +1786,7 @@ module ActiveRecord #:nodoc: # Interpolate custom SQL string in instance context. # Optional record argument is meant for custom insert_sql. def interpolate_sql(sql, record = nil) - instance_eval("%@#{sql.gsub('@', '\@')}@") + instance_eval("%@#{sql.gsub('@', '\@')}@", __FILE__, __LINE__) end # Instantiates objects for all attribute classes that needs more than one constructor parameter. This is done diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 8473150338..329dd7d761 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -287,11 +287,8 @@ class CalculationsTest < ActiveRecord::TestCase # Oracle adapter returns floating point value 636.0 after SUM if current_adapter?(:OracleAdapter) assert_equal 636, Account.sum("2 * credit_limit") - elsif current_adapter?(:SQLite3Adapter) - # Future versions of the SQLite3 adapter will return a number - assert_equal 636, Account.sum("2 * credit_limit").to_i else - assert_equal '636', Account.sum("2 * credit_limit") + assert_equal 636, Account.sum("2 * credit_limit").to_i end end diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index 3a34df2426..9527404f03 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -63,19 +63,19 @@ class ValidationsTest < ActiveRecord::TestCase end def test_error_on_given_context - r = WrongReply.new + r = WrongReply.new(:title => "Valid title") assert !r.valid?(:special_case) - assert "Invalid", r.errors[:title].join + assert_equal "Invalid", r.errors[:author_name].join - r.title = "secret" + r.author_name = "secret" r.content = "Good" assert r.valid?(:special_case) - r.title = nil + r.author_name = nil assert !r.save(:context => :special_case) - assert "Invalid", r.errors[:title].join + assert_equal "Invalid", r.errors[:author_name].join - r.title = "secret" + r.author_name = "secret" assert r.save(:context => :special_case) end diff --git a/activerecord/test/models/reply.rb b/activerecord/test/models/reply.rb index 6cc9ee038a..110d540120 100644 --- a/activerecord/test/models/reply.rb +++ b/activerecord/test/models/reply.rb @@ -17,7 +17,7 @@ class WrongReply < Reply validate :check_empty_title validate :check_content_mismatch, :on => :create validate :check_wrong_update, :on => :update - validate :check_title_is_secret, :on => :special_case + validate :check_author_name_is_secret, :on => :special_case def check_empty_title errors[:title] << "Empty" unless attribute_present?("title") @@ -41,8 +41,8 @@ class WrongReply < Reply errors[:title] << "is Wrong Update" if attribute_present?("title") && title == "Wrong Update" end - def check_title_is_secret - errors[:title] << "Invalid" unless title == "secret" + def check_author_name_is_secret + errors[:author_name] << "Invalid" unless author_name == "secret" end end |