views:

59

answers:

1

I am trying to create similar functionality as this gem authlogix-rpx, which optimistically saves the session/user object even if some of the validated fields are missing.

http://github.com/tardate/authlogic_rpx/tree/master/lib/authlogic_rpx (line 167)

With this gem it's possible to create the record that does not meet validation criteria and later on call the registration_complete? method which return false if all the validations do not pass.

I am not sure how this save is taking place, in my gem (which is an add on to authlogic using oauth2) I have tried doing save(false), save_with_vaidation_false but nothign really works, the validations fail and the record get saved.

Any ideas?

Thanks

A: 

You should be able to run user.save(false) to save the user and then use user.errors.full_messages to access the validation error messages.

Or you could provide the :on parameter to your validations to restrict them to :create, :update or both (:save)

validates_presence_of :email, :on=>:update
aNoble