From 13e00ce6064fd1ce143071e3531e65f64047b013 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 9 Apr 2010 15:56:50 -0300 Subject: fix stack trace lines on class_eval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- .../lib/active_record/attribute_methods/time_zone_conversion.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb') diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb index a8e3e28a7a..783d61383b 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -17,7 +17,7 @@ module ActiveRecord # This enhanced read method automatically converts the UTC time stored in the database to the time zone stored in Time.zone. def define_method_attribute(attr_name) if create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name]) - method_body = <<-EOV + method_body, line = <<-EOV, __LINE__ + 1 def #{attr_name}(reload = false) cached = @attributes_cache['#{attr_name}'] return cached if cached && !reload @@ -25,7 +25,7 @@ module ActiveRecord @attributes_cache['#{attr_name}'] = time.acts_like?(:time) ? time.in_time_zone : time end EOV - generated_attribute_methods.module_eval(method_body, __FILE__, __LINE__) + generated_attribute_methods.module_eval(method_body, __FILE__, line) else super end @@ -35,7 +35,7 @@ module ActiveRecord # This enhanced write method will automatically convert the time passed to it to the zone stored in Time.zone. def define_method_attribute=(attr_name) if create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name]) - method_body = <<-EOV + method_body, line = <<-EOV, __LINE__ + 1 def #{attr_name}=(time) unless time.acts_like?(:time) time = time.is_a?(String) ? Time.zone.parse(time) : time.to_time rescue time @@ -44,7 +44,7 @@ module ActiveRecord write_attribute(:#{attr_name}, time) end EOV - generated_attribute_methods.module_eval(method_body, __FILE__, __LINE__) + generated_attribute_methods.module_eval(method_body, __FILE__, line) else super end -- cgit v1.2.3