diff options
author | Jonathan Roes <jroes@jroes.net> | 2013-03-31 19:12:06 -0300 |
---|---|---|
committer | Jonathan Roes <jroes@jroes.net> | 2013-03-31 19:12:06 -0300 |
commit | da9031ae26d5b377a465aae925f1c3cc9d2c2453 (patch) | |
tree | d0329530cca71a70a803b39fe590b3445bb3d5cf /guides/source | |
parent | 75afe19182de35ce17afe5c8432ec2d87add42b0 (diff) | |
download | rails-da9031ae26d5b377a465aae925f1c3cc9d2c2453.tar.gz rails-da9031ae26d5b377a465aae925f1c3cc9d2c2453.tar.bz2 rails-da9031ae26d5b377a465aae925f1c3cc9d2c2453.zip |
Remove unnecessary / confusing code in example
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/action_controller_overview.md | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 5e99063da8..5e336fffcd 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -561,7 +561,7 @@ Note that while for session values you set the key to `nil`, to delete a cookie Rendering xml and json data --------------------------- -ActionController makes it extremely easy to render `xml` or `json` data. If you generate a controller using scaffolding then it would look something like this: +ActionController makes it extremely easy to render `xml` or `json` data. If you've generated a controller using scaffolding, it would look something like this: ```ruby class UsersController < ApplicationController @@ -576,7 +576,7 @@ 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` . +You may notice in the above code that we're using `render xml: @users`, not `render xml: @users.to_xml`. If the object is not a String, then Rails will automatically invoke `to_xml` for us. Filters ------- @@ -599,15 +599,6 @@ class ApplicationController < ActionController::Base redirect_to new_login_url # halts request cycle end end - - # The logged_in? method simply returns true if the user is logged - # in and false otherwise. It does this by "booleanizing" the - # current_user method we created previously using a double ! operator. - # Note that this is not common in Ruby and is discouraged unless you - # really mean to convert something into true or false. - def logged_in? - !!current_user - end end ``` |