"Password can't be blank" error
Hi Sergio, I think I've found a small bug.
devise_invitable (0.5.6) devise (1.4.9) rails (3.1.1)
This line of code: u = User.invite!({:email => email}, inviter) does not set :invitation_token attribute (in earlier gem versions it did), which results in (u.valid? == false) with "Password can't be blank" error (because u.invitation_token == nil). But if I then do: u.invite! u.invitation_token is set, and everything is fine.
So in my code I had to fix it like this: u = User.invite!({:email => email}, inviter) u.invite! unless u.valid? # fix "Password can't be blank" issue.
This is just FYI, does not block me, you may close it if isn't reproduced on newer gem versions. Thank you very much for this gem!
Do you have enabled validate_on_invite?
Do you have enabled validate_on_invite? Probably bug is fixed in 0.5.7
Yes: #devise.rb config.validate_on_invite = true
OK I will try 0.5.7. Thank you!
I simply overrode password_required? - in my model- if indeed this is the same problem
def password_required? if new_record? false else !persisted? || !password.nil? || !password_confirmation.nil? end end
@feralbob which version?
@scambra - Should be 0.6.0
Still reproduced in 0.6.0 .
I submitted a pull request for this issue, but I'm going to redo per @scambra's request. Check it out and see if it helps you: https://github.com/scambra/devise_invitable/pull/152
It should be fixed with 842ee65 which fixed #152