Inconsitent fault with my UserEngine/LoginEngine


I’ve got a bizarre, seemingly random error with my instance of
UserEngine or LoginEngine. It occurs sometimes when new users attempt
to signup to my application. The error message in the log files is

Unable to send confirmation E-Mail:
undefined method `+’ for nil:NilClass

To try and figure out what’s going on here I’ve copied and pasted some
methods from AuthenticatedUser within LoginEngine, and introduced my own
trace statements. It looks like it’s getting through to
new_security_token within AuthenticatedUser, but I believe it’s failing
on this line

AuthenticatedUser.hashed(self.salted_password + +

I’m guessing that the + has got something to do with no salted_password
being defined for the user…?

Has anyone encountered this before, or can think of a series of actions
that would cause a new user (during signup) to have no salted_password
created for them?

This is really bugging me, as the only way I’ve found to fix it is to
restart my app - and that’s hardly a fix.

And help or tips would be appreciated.


Hamish Rickerby
hamish [at]

I’ve just been looking at the code on this a little more, and I’m
wondering if the callback to crypt_password is executing correctly - as
I see it that’s where the creation of the salted_password is supposed to
happen, just after the validations and just before the save to db…
Does that give anyone any hints on what could be wrong with my app?
Anyone found that for some odd reason/configuration it fails to trigger
all the time?



I’ve fixed it. It was the same problem that other users have reported
with transactions not being saved correctly. Removal of the
User.transaction cleared that right up.

So, for anyone else in the future who is wondering why their email
messages aren’t being sent from the login_engine, and they just get a

Unable to send confirmation E-Mail:
undefined method `+’ for nil:NilClass

message in the log files - REMOVE the transaction around the majority of
the signup method in your overwritten user_controller.rb.

Hamish Rickerby
hamish [at]

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