Strange acts_as_authenticated code in account/index action


I’m using the acts_as_authenticated plugin. I have not yet modified the
AccountController much. All the default actions are still there

Then, I noted a strange behaviour: When the user is not logged on
tries to access the account/index action, the redirect to the signup
page is
not made.

Here’s the code for the index action of the AccountController

say something nice, you goof! something sweet.

def index
redirect_to(:action => ‘signup’) unless logged_in? || User.count > 0

There is the || User.count > 0 ? It is causing me problems, here is why

when the user is not logged in, the logged_in? returns false, but being
OR operation, if the User.count > 0, true prevails, so, it assumes the
is logged in when there is a user in the database.

Here’s the full controller code:

Does anyone know why the author did that?

Thanks in advance,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs