aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-11-05 16:11:08 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2009-11-05 16:12:02 -0800
commit1c047be0fc06c74d4b5b9e1682c79749f47109f5 (patch)
tree624a079ac6ff2d98c87fd23ad6342c60deffcf75
parent60911c39336fea92536f78a4deb6b52535b613cd (diff)
downloadrails-1c047be0fc06c74d4b5b9e1682c79749f47109f5.tar.gz
rails-1c047be0fc06c74d4b5b9e1682c79749f47109f5.tar.bz2
rails-1c047be0fc06c74d4b5b9e1682c79749f47109f5.zip
If class doesn't have a name, there's no implied layout name, so don't set up a _layout method
-rw-r--r--actionpack/lib/abstract_controller/layouts.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb
index 8293e79b0a..1616f8030a 100644
--- a/actionpack/lib/abstract_controller/layouts.rb
+++ b/actionpack/lib/abstract_controller/layouts.rb
@@ -89,7 +89,7 @@ module AbstractController
# ==== Returns
# String:: A template name
def _implied_layout_name
- name.underscore
+ name && name.underscore
end
# Takes the specified layout and creates a _layout method to be called
@@ -119,17 +119,19 @@ module AbstractController
when true
raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil"
when nil
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
- def _layout(details)
- self.class.cache_layout(details) do
- if template_exists?("#{_implied_layout_name}", details, :_prefix => "layouts")
- "#{_implied_layout_name}"
- else
- super
+ if name
+ self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
+ def _layout(details)
+ self.class.cache_layout(details) do
+ if template_exists?("#{_implied_layout_name}", details, :_prefix => "layouts")
+ "#{_implied_layout_name}"
+ else
+ super
+ end
end
end
- end
- RUBY
+ RUBY
+ end
end
self.class_eval { private :_layout }
end