Permalink
Browse files

Merge pull request #27692 from y-yagi/make_render_work_with_ac_params

make `render` work with AC::Params
  • Loading branch information...
eileencodes authored and rafaelfranca committed Jan 16, 2017
1 parent 210e36c commit 280a5d8827fcae376b74e3349e8734cd1d6132f4
Showing with 6 additions and 3 deletions.
  1. +1 −2 actionpack/test/controller/render_test.rb
  2. +5 −1 actionview/lib/action_view/rendering.rb
@@ -325,8 +325,7 @@ def test_dynamic_render
end
def test_permitted_dynamic_render_file_hash
- skip "FIXME: this test passes on 4-2-stable but not master. Why?"
- assert File.exist?(File.join(File.dirname(__FILE__), '../../test/abstract_unit.rb'))
+ assert File.exist?(File.join(File.dirname(__FILE__), "../../test/abstract_unit.rb"))
response = get :dynamic_render_permit, params: { id: { file: '../\\../test/abstract_unit.rb' } }
assert_equal File.read(File.join(File.dirname(__FILE__), '../../test/abstract_unit.rb')),
response.body
@@ -125,7 +125,11 @@ def _normalize_args(action=nil, options={})
key = action.include?(?/) ? :template : :action
options[key] = action
else
- options[:partial] = action
+ if action.respond_to?(:permitted?) && action.permitted?
+ options = action
+ else
+ options[:partial] = action
+ end
end
options

0 comments on commit 280a5d8

Please sign in to comment.