diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-12-25 23:01:17 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-25 23:05:34 +0000 |
commit | cd1d6e8768ae13b11bc343701037b20ad35e6f1e (patch) | |
tree | b400f930c3ca31a26c41ab0d30c4283dc17b2d79 /actionpack/lib | |
parent | d67e03871eabb912434dafac3eeb8e6ea7c5585f (diff) | |
download | rails-cd1d6e8768ae13b11bc343701037b20ad35e6f1e.tar.gz rails-cd1d6e8768ae13b11bc343701037b20ad35e6f1e.tar.bz2 rails-cd1d6e8768ae13b11bc343701037b20ad35e6f1e.zip |
Make ActionController#render(string) work as a shortcut for render :action => string. [#1435]
Examples:
# Instead of render(:action => 'other_action')
render('other_action')
Note : Argument must not have any '/'
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 29f1c84f03..e9c96b0ba4 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -866,9 +866,11 @@ module ActionController #:nodoc: elsif options == :update options = extra_options.merge({ :update => true }) elsif options.is_a?(String) - case position = options.index('/') + case options.index('/') when 0 extra_options[:file] = options + when nil + extra_options[:action] = options else extra_options[:template] = options end |