aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-02-08 05:24:53 +0000
committerMarcel Molina <marcel@vernix.org>2006-02-08 05:24:53 +0000
commit73ed47ddec458a512178de584e896ebb276c0125 (patch)
treea398aa523ce4ba0db040585abdfbd085ac37131f /actionpack/lib/action_controller
parentba2619f53911d5b56b76ab45af882caa7334e3cf (diff)
downloadrails-73ed47ddec458a512178de584e896ebb276c0125.tar.gz
rails-73ed47ddec458a512178de584e896ebb276c0125.tar.bz2
rails-73ed47ddec458a512178de584e896ebb276c0125.zip
Replace dubious controller parent class in filter docs. Closes #3655, #3722.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3551 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/filters.rb2
-rw-r--r--actionpack/lib/action_controller/layout.rb10
2 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb
index 0149d52303..9bfe3ee1da 100644
--- a/actionpack/lib/action_controller/filters.rb
+++ b/actionpack/lib/action_controller/filters.rb
@@ -141,7 +141,7 @@ module ActionController #:nodoc:
# # will run the :authenticate filter
# end
#
- # class SignupController < ActionController::Base
+ # class SignupController < ApplicationController
# # will not run the :authenticate filter
# skip_before_filter :authenticate
# end
diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb
index f2a5b97bf1..0934b8bfdc 100644
--- a/actionpack/lib/action_controller/layout.rb
+++ b/actionpack/lib/action_controller/layout.rb
@@ -66,9 +66,11 @@ module ActionController #:nodoc:
# <tt>app/views/layouts/weblog.rhtml</tt> or <tt>app/views/layouts/weblog.rxml</tt> exists then it will be automatically set as
# the layout for your WeblogController. You can create a layout with the name <tt>application.rhtml</tt> or <tt>application.rxml</tt>
# and this will be set as the default controller if there is no layout with the same name as the current controller and there is
- # no layout explicitly assigned with the +layout+ method. Setting a layout explicitly will always override the automatic behaviour
- # for the controller where the layout is set. Explicitly setting the layout in a parent class, though, will not override the
- # child class's layout assignement if the child class has a layout with the same name.
+ # no layout explicitly assigned with the +layout+ method. Nested controllers use the same folder structure for automatic layout.
+ # assignment. So an Admin::WeblogController will look for a template named <tt>app/views/layouts/admin/weblog.rhtml</tt>.
+ # Setting a layout explicitly will always override the automatic behaviour for the controller where the layout is set.
+ # Explicitly setting the layout in a parent class, though, will not override the child class's layout assignement if the child
+ # class has a layout with the same name.
#
# == Inheritance for layouts
#
@@ -175,7 +177,7 @@ module ActionController #:nodoc:
def inherited_with_layout(child)
inherited_without_layout(child)
child.send :include, Reloadable
- layout_match = child.name.underscore.sub(/_controller$/, '')
+ layout_match = child.name.underscore.sub(/_controller$/, '').sub(/^controllers\//, '')
child.layout(layout_match) unless layout_list.grep(%r{layouts/#{layout_match}\.[a-z][0-9a-z]*$}).empty?
end