diff options
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering.rb')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 1dec3f2c3e..ac407bda5e 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -157,13 +157,23 @@ module AbstractController options[:_template_name] = options[:file] end - name = (options[:_template_name] || action_name).to_s + name = (options[:_template_name] || options[:action] || action_name).to_s + options[:_prefix] ||= _prefix if (options.keys & [:partial, :file, :template]).empty? + + details = _normalize_details(options) options[:_template] ||= with_template_cache(name) do - find_template(name, { :formats => formats }, options) + find_template(name, details, options) end end + def _normalize_details(options) + details = { :formats => formats } + details[:formats] = Array(options[:format]) if options[:format] + details[:locale] = Array(options[:locale]) if options[:locale] + details + end + def find_template(name, details, options) view_paths.find(name, details, options[:_prefix], options[:_partial]) end |