diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-04-22 17:16:28 -0700 |
---|---|---|
committer | Yehuda Katz and Carl Lerche <wycats@gmail.com> | 2009-04-22 17:24:41 -0700 |
commit | 0a132c2fe13fb2b8d5dade9cf6abd70601376287 (patch) | |
tree | cf9194a0a9df3cf36e7a1ffbe8b8e16274c94ee9 /actionpack/lib/action_controller/base | |
parent | b2d6fdae353be4fca41d7ac1839f30d9737162fd (diff) | |
download | rails-0a132c2fe13fb2b8d5dade9cf6abd70601376287.tar.gz rails-0a132c2fe13fb2b8d5dade9cf6abd70601376287.tar.bz2 rails-0a132c2fe13fb2b8d5dade9cf6abd70601376287.zip |
Refactor ActionView::Path
* Decouple from ActionController and ActionMailer
* Bring back localization support.
* Prepare to decouple templates from the filesystem.
* Prepare to decouple localization from ActionView
* Fix ActionMailer to take advantage of ActionView::Path
Diffstat (limited to 'actionpack/lib/action_controller/base')
-rw-r--r-- | actionpack/lib/action_controller/base/layout.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/base/render.rb | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/base/layout.rb b/actionpack/lib/action_controller/base/layout.rb index 4fcef6c5d9..1ad5191c73 100644 --- a/actionpack/lib/action_controller/base/layout.rb +++ b/actionpack/lib/action_controller/base/layout.rb @@ -182,7 +182,7 @@ module ActionController #:nodoc: def memoized_find_layout(layout, formats) #:nodoc: return layout if layout.nil? || layout.respond_to?(:render) prefix = layout.to_s =~ /layouts\// ? nil : "layouts" - view_paths.find_by_parts(layout.to_s, formats, prefix) + view_paths.find_by_parts(layout.to_s, {:formats => formats}, prefix) end def find_layout(*args) diff --git a/actionpack/lib/action_controller/base/render.rb b/actionpack/lib/action_controller/base/render.rb index 606df58518..52934076e6 100644 --- a/actionpack/lib/action_controller/base/render.rb +++ b/actionpack/lib/action_controller/base/render.rb @@ -374,8 +374,13 @@ module ActionController render_for_file(name.sub(/^\//, ''), [layout, true], options) end end - + + # ==== Arguments + # parts<Array[String, Array[Symbol*], String, Boolean]>:: + # Example: ["show", [:html, :xml], "users", false] def render_for_parts(parts, layout, options = {}) + parts[1] = {:formats => parts[1], :locales => [I18n.locale]} + tmp = view_paths.find_by_parts(*parts) layout = _pick_layout(*layout) unless tmp.exempt_from_layout? |