From b95d6e84b00bd926b1118f6a820eca7a870b8c35 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- railties/guides/source/action_controller_overview.textile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/guides/source/action_controller_overview.textile') diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index ec2d5b2787..b38ae07043 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/railties/guides/source/action_controller_overview.textile @@ -115,7 +115,7 @@ h4. Routing Parameters The +params+ hash will always contain the +:controller+ and +:action+ keys, but you should use the methods +controller_name+ and +action_name+ instead to access these values. Any other parameters defined by the routing, such as +:id+ will also be available. As an example, consider a listing of clients where the list can show either active or inactive clients. We can add a route which captures the +:status+ parameter in a "pretty" URL: -map.connect "/clients/:status", +map.connect "/clients/:status", :controller => "clients", :action => "index", :foo => "bar" @@ -296,7 +296,7 @@ class MainController < ApplicationController # Will persist all flash values. flash.keep - # You can also use a key to keep only some kind of value. + # You can also use a key to keep only some kind of value. # flash.keep(:notice) redirect_to users_url end @@ -369,14 +369,14 @@ class UsersController < ApplicationController end -Notice that in the above case code is render :xml => @users and not render :xml => @users.to_xml. That is because if the input is not string then rails automatically invokes +to_xml+ . +Notice that in the above case code is render :xml => @users and not render :xml => @users.to_xml. That is because if the input is not string then rails automatically invokes +to_xml+ . h3. Filters -Filters are methods that are run before, after or "around" a controller action. +Filters are methods that are run before, after or "around" a controller action. -Filters are inherited, so if you set a filter on +ApplicationController+, it will be run on every controller in your application. +Filters are inherited, so if you set a filter on +ApplicationController+, it will be run on every controller in your application. Before filters may halt the request cycle. A common before filter is one which requires that a user is logged in for an action to be run. You can define the filter method this way: @@ -536,7 +536,7 @@ You will see how the token gets added as a hidden field:
- @@ -659,7 +659,7 @@ class ClientsController < ApplicationController # returns it. The user will get the PDF as a file download. def download_pdf client = Client.find(params[:id]) - send_data generate_pdf(client), + send_data generate_pdf(client), :filename => "#{client.name}.pdf", :type => "application/pdf" end -- cgit v1.2.3