diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-05-19 16:37:41 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-20 15:18:57 +0200 |
commit | aacf2581cde0147dc66c3eeacf6d7447c2bbafdf (patch) | |
tree | a7f099044c0e8678454af5852a415c757c567c94 /activeresource | |
parent | 7f07cc364a7ee7ceae21b29b54467fde0db93389 (diff) | |
download | rails-aacf2581cde0147dc66c3eeacf6d7447c2bbafdf.tar.gz rails-aacf2581cde0147dc66c3eeacf6d7447c2bbafdf.tar.bz2 rails-aacf2581cde0147dc66c3eeacf6d7447c2bbafdf.zip |
refactor evals and adds some __FILE__ and __LINE__
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activeresource')
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index b976844c1c..6397fbc280 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -582,12 +582,13 @@ module ActiveResource # Clear prefix parameters in case they have been cached @prefix_parameters = nil - # Redefine the new methods. - code, line = <<-end_code, __LINE__ + 1 - def prefix_source() "#{value}" end - def prefix(options={}) "#{prefix_call}" end - end_code - silence_warnings { instance_eval code, __FILE__, line } + silence_warnings do + # Redefine the new methods. + instance_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 + def prefix_source() "#{value}" end + def prefix(options={}) "#{prefix_call}" end + RUBY_EVAL + end rescue logger.error "Couldn't set prefix: #{$!}\n #{code}" if logger raise |