aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/abstract/layouts.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-05-07 10:45:29 -0500
committerJoshua Peek <josh@joshpeek.com>2009-05-07 10:45:29 -0500
commita747ab5b20b9d543e9d311070e3b720c761ae716 (patch)
treec8e671f1f6a722b56d5ca005977fbe2e210ffda5 /actionpack/lib/action_controller/abstract/layouts.rb
parentaf40fa6d036d86895e7be4ef46a615d44eb41ede (diff)
downloadrails-a747ab5b20b9d543e9d311070e3b720c761ae716.tar.gz
rails-a747ab5b20b9d543e9d311070e3b720c761ae716.tar.bz2
rails-a747ab5b20b9d543e9d311070e3b720c761ae716.zip
Whitespace!
Diffstat (limited to 'actionpack/lib/action_controller/abstract/layouts.rb')
-rw-r--r--actionpack/lib/action_controller/abstract/layouts.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/actionpack/lib/action_controller/abstract/layouts.rb b/actionpack/lib/action_controller/abstract/layouts.rb
index 76130f8dc0..69fe4efc19 100644
--- a/actionpack/lib/action_controller/abstract/layouts.rb
+++ b/actionpack/lib/action_controller/abstract/layouts.rb
@@ -9,18 +9,18 @@ module AbstractController
unless [String, Symbol, FalseClass, NilClass].include?(layout.class)
raise ArgumentError, "Layouts must be specified as a String, Symbol, false, or nil"
end
-
+
@_layout = layout || false # Converts nil to false
_write_layout_method
end
-
+
def _implied_layout_name
name.underscore
end
-
+
# Takes the specified layout and creates a _layout method to be called
# by _default_layout
- #
+ #
# If the specified layout is a:
# String:: return the string
# Symbol:: call the method specified by the symbol
@@ -49,35 +49,34 @@ module AbstractController
end
end
end
-
+
def _render_template(template, options)
_action_view._render_template_with_layout(template, options[:_layout])
end
-
+
private
-
def _layout() end # This will be overwritten
-
+
def _layout_for_name(name)
unless [String, FalseClass, NilClass].include?(name.class)
raise ArgumentError, "String, false, or nil expected; you passed #{name.inspect}"
end
-
+
name && view_paths.find_by_parts(name, {:formats => formats}, "layouts")
end
-
+
def _default_layout(require_layout = false)
if require_layout && !_layout
- raise ArgumentError,
+ raise ArgumentError,
"There was no default layout for #{self.class} in #{view_paths.inspect}"
end
-
+
begin
layout = _layout_for_name(_layout)
rescue NameError => e
- raise NoMethodError,
+ raise NoMethodError,
"You specified #{@_layout.inspect} as the layout, but no such method was found"
end
end
end
-end \ No newline at end of file
+end