diff options
author | Yehuda Katz <wycats@gmail.com> | 2008-12-26 12:29:44 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2008-12-26 12:29:44 -0800 |
commit | 9b2da52914720d87d2c6d6d94f7fab6a86a70daf (patch) | |
tree | 9ddd76ed6c03e3a8c672b4b1214e4bd490670b6e /actionpack/lib | |
parent | e4314d4362d288ff72cec5a5a9644a3a3cbf23af (diff) | |
parent | db5a98e6cbb88331a6ce484260e9cce9ba882bcd (diff) | |
download | rails-9b2da52914720d87d2c6d6d94f7fab6a86a70daf.tar.gz rails-9b2da52914720d87d2c6d6d94f7fab6a86a70daf.tar.bz2 rails-9b2da52914720d87d2c6d6d94f7fab6a86a70daf.zip |
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 9bf044b6c0..5b83494eb4 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -859,16 +859,20 @@ 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) + options = { :template => default_template.filename, :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 + extra_options[:action] = options + else + extra_options[:template] = options end options = extra_options @@ -1189,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 |