diff options
author | Xavier Noria <fxn@hashref.com> | 2013-09-07 01:33:19 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-09-07 01:33:19 -0700 |
commit | c989a18a74d970be86c537766f14916bd06fe176 (patch) | |
tree | cf2ab71e426364c6b82e884b00146acf1345abc1 /guides/source/action_controller_overview.md | |
parent | 6a91a3307ff6556225ab8717617074cea20222e0 (diff) | |
parent | 2c8bc2cdcdb7b144b7a583d24922fd8064bcff3d (diff) | |
download | rails-c989a18a74d970be86c537766f14916bd06fe176.tar.gz rails-c989a18a74d970be86c537766f14916bd06fe176.tar.bz2 rails-c989a18a74d970be86c537766f14916bd06fe176.zip |
Merge pull request #12155 from jetthoughts/reformat_guides_code_examples
Use Ruby on Rails Coding Conventions for code examples in the guides
Diffstat (limited to 'guides/source/action_controller_overview.md')
-rw-r--r-- | guides/source/action_controller_overview.md | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 8dcd544a52..8dfecd0190 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -808,11 +808,11 @@ class AdminsController < ApplicationController private - def authenticate - authenticate_or_request_with_http_digest do |username| - USERS[username] + def authenticate + authenticate_or_request_with_http_digest do |username| + USERS[username] + end end - end end ``` @@ -839,13 +839,13 @@ class ClientsController < ApplicationController private - def generate_pdf(client) - Prawn::Document.new do - text client.name, align: :center - text "Address: #{client.address}" - text "Email: #{client.email}" - end.render - end + def generate_pdf(client) + Prawn::Document.new do + text client.name, align: :center + text "Address: #{client.address}" + text "Email: #{client.email}" + end.render + end end ``` @@ -1048,9 +1048,9 @@ class ApplicationController < ActionController::Base private - def record_not_found - render text: "404 Not Found", status: 404 - end + def record_not_found + render text: "404 Not Found", status: 404 + end end ``` @@ -1062,10 +1062,10 @@ class ApplicationController < ActionController::Base private - def user_not_authorized - flash[:error] = "You don't have access to this section." - redirect_to :back - end + def user_not_authorized + flash[:error] = "You don't have access to this section." + redirect_to :back + end end class ClientsController < ApplicationController @@ -1079,10 +1079,10 @@ class ClientsController < ApplicationController private - # If the user is not authorized, just throw the exception. - def check_authorization - raise User::NotAuthorized unless current_user.admin? - end + # If the user is not authorized, just throw the exception. + def check_authorization + raise User::NotAuthorized unless current_user.admin? + end end ``` |