aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-02-02 22:04:11 +0100
committerXavier Noria <fxn@hashref.com>2011-02-02 22:04:11 +0100
commita96a9a494856c57bb8773d8d22bbee176cda9d6e (patch)
tree809c810883599b60cb66537e9403cb7c1d5ad335 /actionpack/lib/action_controller
parent68e3fb81090ba67575e513407fc2463dba3b002b (diff)
parent2446b1307ecf4ac13dc9ed3bcaf5a03ef3fcef98 (diff)
downloadrails-a96a9a494856c57bb8773d8d22bbee176cda9d6e.tar.gz
rails-a96a9a494856c57bb8773d8d22bbee176cda9d6e.tar.bz2
rails-a96a9a494856c57bb8773d8d22bbee176cda9d6e.zip
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal.rb60
1 files changed, 55 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 3df3c341bb..032769a5c6 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -43,12 +43,62 @@ module ActionController
end
end
- # Provides a way to get a valid Rack application from a controller.
+ # ActionController::Metal is the simplest possible controller, providing a
+ # valid Rack interface without the additional niceties provided by
+ # ActionController::Base.
+ #
+ # A sample Metal controller might look like this:
+ #
+ # class HelloController < ActionController::Metal
+ # def index
+ # self.response_body = "Hello World!"
+ # end
+ # end
+ #
+ # And then to route requests to your Metal controller, you would add
+ # something like this to <tt>config/routes.rb</tt>:
+ #
+ # match '/hello', :to => HelloController.action(:index),
+ # :as => 'hello'
+ #
+ # The action method returns a valid Rack application for the \Rails
+ # router to dispatch to.
+ #
+ # == Rendering Helpers
+ #
+ # ActionController::Metal by default provides no utilities for rendering
+ # views, partials, or other responses aside from explicitly calling of
+ # response_body=, content_type=, and status=. To
+ # add the render helpers you're used to having in a normal controller, you
+ # can do the following:
+ #
+ # class HelloController < ActionController::Metal
+ # include ActionController::Rendering
+ # append_view_path Rails.root + "app/views"
+ #
+ # def index
+ # render "hello/index"
+ # end
+ # end
+ #
+ # == Redirection Helpers
+ #
+ # To add redirection helpers to your Metal controller, do the following:
+ #
+ # class HelloController < ActionController::Metal
+ # include ActionController::Redirecting
+ #
+ # def index
+ # redirect_to root_url
+ # end
+ # end
+ #
+ # == Other Helpers
+ #
+ # You can refer to the modules defined in ActionController to see
+ # the other features in ActionController::Base that you can bring
+ # into your Metal controller.
#
- # In AbstractController, dispatching is triggered directly by calling #process on a new controller.
- # <tt>ActionController::Metal</tt> provides an <tt>action</tt> method that returns a valid Rack application for a
- # given action. Other rack builders, such as Rack::Builder, Rack::URLMap, and the \Rails router,
- # can dispatch directly to actions returned by controllers in your application.
class Metal < AbstractController::Base
abstract!