diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-12-25 22:11:06 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-25 22:26:03 +0000 |
commit | d67e03871eabb912434dafac3eeb8e6ea7c5585f (patch) | |
tree | ac7d7092f56c5e5bfe6c690d44bbf5c91fca8c24 /actionpack/lib | |
parent | 061952392afd1dae1aa97a816e9a0c79df7c4514 (diff) | |
download | rails-d67e03871eabb912434dafac3eeb8e6ea7c5585f.tar.gz rails-d67e03871eabb912434dafac3eeb8e6ea7c5585f.tar.bz2 rails-d67e03871eabb912434dafac3eeb8e6ea7c5585f.zip |
Make ActionController#render(string) work as a shortcut for render :template => string. [#1435]
Examples:
# Instead of render(:template => 'controller/action')
render('controller/action')
Note : Argument must not begin with a '/', but have at least one '/'
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 9bf044b6c0..29f1c84f03 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 options.index('/') + case position = options.index('/') when 0 extra_options[:file] = options + else + extra_options[:template] = options end options = extra_options |