views:

133

answers:

3
(rdb:1) @account_session = AccountSession.new  
# => <AccountSession: no credentials provided>
(rdb:1) @account_session.errors
# => <Authlogic::Session::Validation::Errors:0x213cc78 @errors={}, @base=#<AccountSession: no credentials provided>>

How do I prevent this? Also note, that credentials can't be provided in advance because that will populate the :new form with (incorrect) data. A new signin form should be blank.

A: 

Are you validating your model in one of your methods/before-filters,etc?

Lichtamberg
A: 

I reproduced this on a vanilla Rails install that contains only AuthLogic. It revealed that the behavior described in this question is actually AuthLogic design behavior. I don't like this because calling #new on the model shouldn't result in errors if none really exist. And it's also funky if a form has UI elements that show error styling for @base errors. I'll address this on the gem's github issues.

Gavin
My message to AuthLogic owner:... Why add @base errors on a new Session instance? ... I'm thinking of forking Authlogic to remove this behavior. ... GavinHis response:I agree, I'll see what I can do to change this. Thanks.
Gavin
A: 

http://github.com/binarylogic/authlogic/issues/closed#issue/34 See last entry. Hope it helps. Frank

Frank