diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/abstract_controller/layouts.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/active_model_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 5 |
5 files changed, 9 insertions, 11 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 319472c937..5cd7a90ab5 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -245,7 +245,7 @@ module AbstractController case defined?(@_layout) ? @_layout : nil when String - self.class_eval %{def _layout; #{@_layout.inspect} end} + self.class_eval %{def _layout; #{@_layout.inspect} end}, __FILE__, __LINE__ when Symbol self.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1 def _layout @@ -259,9 +259,9 @@ module AbstractController ruby_eval when Proc define_method :_layout_from_proc, &@_layout - self.class_eval %{def _layout; _layout_from_proc(self) end} + self.class_eval %{def _layout; _layout_from_proc(self) end}, __FILE__, __LINE__ when false - self.class_eval %{def _layout; end} + self.class_eval %{def _layout; end}, __FILE__, __LINE__ when true raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil" when nil diff --git a/actionpack/lib/action_view/helpers/active_model_helper.rb b/actionpack/lib/action_view/helpers/active_model_helper.rb index d9f09b5dc5..0cddd09eb0 100644 --- a/actionpack/lib/action_view/helpers/active_model_helper.rb +++ b/actionpack/lib/action_view/helpers/active_model_helper.rb @@ -43,7 +43,7 @@ module ActionView end %w(tag content_tag to_date_select_tag to_datetime_select_tag to_time_select_tag).each do |meth| - module_eval "def #{meth}(*) error_wrapping(super) end" + module_eval "def #{meth}(*) error_wrapping(super) end", __FILE__, __LINE__ end def error_wrapping(html_tag) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 414a5d4cd9..b3db3151d3 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1111,7 +1111,7 @@ module ActionView end (field_helpers - %w(label check_box radio_button fields_for hidden_field)).each do |selector| - src, line = <<-end_src, __LINE__ + 1 + class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{selector}(method, options = {}) # def text_field(method, options = {}) @template.send( # @template.send( #{selector.inspect}, # "text_field", @@ -1119,8 +1119,7 @@ module ActionView method, # method, objectify_options(options)) # objectify_options(options)) end # end - end_src - class_eval src, __FILE__, line + RUBY_EVAL end def fields_for(record_or_name_or_array, *args, &block) diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index f6417d5c2c..5517a56fb9 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -82,7 +82,7 @@ module ActionView def helper_method(*methods) # Almost a duplicate from ActionController::Helpers methods.flatten.each do |method| - _helpers.module_eval <<-end_eval + _helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1 def #{method}(*args, &block) # def current_user(*args, &block) _test_case.send(%(#{method}), *args, &block) # test_case.send(%(current_user), *args, &block) end # end diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index d1e1338a17..2f3869994c 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -1425,12 +1425,11 @@ class FormHelperTest < ActionView::TestCase class LabelledFormBuilder < ActionView::Helpers::FormBuilder (field_helpers - %w(hidden_field)).each do |selector| - src, line = <<-END_SRC, __LINE__ + 1 + class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{selector}(field, *args, &proc) ("<label for='\#{field}'>\#{field.to_s.humanize}:</label> " + super + "<br/>").html_safe end - END_SRC - class_eval src, __FILE__, line + RUBY_EVAL end end |