This project is archived and is in readonly mode.
action_controller layout candidate for layout fails
-
ransom-briggs (at uiowa)
attaching the diff ...
-
Paul Hinze
I can confirm that this is a problem and that the patch supplied seems to solve it.
-
thedarkone
When exactly does this happen (so we can also add a test case)?
-
ransom-briggs (at uiowa)
vendor/plugins/footnotes-edge/lib/textmate_initialize.rb does not play well with 2.3
8 def render(options = {}, deprecated_status = {}, &block) #:doc: 9 if options.is_a? Hash 10 @render_without_footnotes = (options.delete(:footnotes) == false) 11 end => 12 footnotes_original_render(options, deprecated_status, &block) 13 end
the options = {} causes the {} to be passed down - if it doesn't to through footnotes-edge then it gets initialized to nil in
44 def render_with_benchmark(options = nil, extra_options = {}, &block)
and then render sets a sane :template parameter which is used
891 def render(options = nil, extra_options = {}, &block) #:doc: 892 raise DoubleRenderError, "Can only render or redirect once per action" if performed? 893 894 validate_render_arguments(options, extra_options, block_given?) 895 896 if options.nil? 897 options = { :template => default_template, :layout => true }
so we will just stop using footnotes edge since no one in our group will miss it
-
ransom-briggs (at uiowa)
another way to fix this would be to change line 896 in
vendor/rails/actionpack/lib/action_controller/base.rb
891 def render(options = nil, extra_options = {}, &block) #:doc: 892 raise DoubleRenderError, "Can only render or redirect once per action" if performed? 893 894 validate_render_arguments(options, extra_options, block_given?) 895 896 if options.nil? 897 options = { :template => default_template, :layout => true }891 def render(options = nil, extra_options = {}, &block) #:doc: 892 raise DoubleRenderError, "Can only render or redirect once per action" if performed? 893 894 validate_render_arguments(options, extra_options, block_given?) 895 896 if options.nil? || options.empty? 897 options = { :template => default_template, :layout => true } -
ransom-briggs (at uiowa)
sorry - I need to learn the formatting language of lighthouse better, my suggestion was that in the render method, the options.nil? section should also be used when options is empty?.
-
Matt Dean
I also came across this problem in the following use case:
def show options = {} returning choose_template do |template| options[:template] = template unless template.blank? end render options endWhile there are certainly alternate approaches for fixing this on our end, the "options.nil? || options.empty?" approach recommended by ransom-briggs above did the trick for us (though we used options.blank? instead).
-
Derrick Spell
+1 for using options.blank? instead of options.nil?. Although doing (options.nil? || options.empty?) does indeed do the same thing and might arguably be more explanatory.
-
Santiago Pastorino
- State changed from new to open
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
