diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-12-26 01:03:18 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-26 01:12:11 +0000 |
commit | 80307c8b0a889acc7abb7f4e52fd4c02e1063ba8 (patch) | |
tree | c4cb570b8f29a63408c3b74f2cbedd383c48d237 /actionpack/lib | |
parent | cd1d6e8768ae13b11bc343701037b20ad35e6f1e (diff) | |
download | rails-80307c8b0a889acc7abb7f4e52fd4c02e1063ba8.tar.gz rails-80307c8b0a889acc7abb7f4e52fd4c02e1063ba8.tar.bz2 rails-80307c8b0a889acc7abb7f4e52fd4c02e1063ba8.zip |
Make ActionController#render(symbol) behave same as ActionController#render(string) [#1435]
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index e9c96b0ba4..cb654534af 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -859,14 +859,14 @@ module ActionController #:nodoc: def render(options = nil, extra_options = {}, &block) #:doc: raise DoubleRenderError, "Can only render or redirect once per action" if performed? - validate_render_arguments(options, extra_options) + validate_render_arguments(options, extra_options, block_given?) if options.nil? return render(:file => default_template, :layout => true) elsif options == :update options = extra_options.merge({ :update => true }) - elsif options.is_a?(String) - case options.index('/') + elsif options.is_a?(String) || options.is_a?(Symbol) + case options.to_s.index('/') when 0 extra_options[:file] = options when nil @@ -1193,8 +1193,8 @@ module ActionController #:nodoc: end end - def validate_render_arguments(options, extra_options) - if options && options != :update && !options.is_a?(String) && !options.is_a?(Hash) + def validate_render_arguments(options, extra_options, has_block) + if options && (has_block && options != :update) && !options.is_a?(String) && !options.is_a?(Hash) && !options.is_a?(Symbol) raise RenderError, "You called render with invalid options : #{options.inspect}" end |