Browse files

Remove unnecessary / confusing code in example

  • Loading branch information...
1 parent 75afe19 commit da9031ae26d5b377a465aae925f1c3cc9d2c2453 @jroes jroes committed Mar 31, 2013
Showing with 2 additions and 11 deletions.
  1. +2 −11 guides/source/
@@ -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:
class UsersController < ApplicationController
@@ -576,7 +576,7 @@ class UsersController < ApplicationController
-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.
@@ -599,15 +599,6 @@ class ApplicationController < ActionController::Base
redirect_to new_login_url # halts request cycle
- # 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

0 comments on commit da9031a

Please sign in to comment.