I posted this on stackoverflow and haven't gotten an answer, so trying to 
see if anyone here can help. 

Since the code is rather long, i've put my controller, show template, and 
the devise related code in a gist.<https://gist.github.com/onthespotqa/7631577>

I'm trying to implement the override method outlined here Devise- Override 
Confirmation<https://github.com/plataformatec/devise/wiki/How-To%3a-Override-confirmations-so-users-can-pick-their-own-passwords-as-part-of-confirmation-activation>.
 
My version of rails is 4 and ruby is 2.0. My implementation involves 
multiple resources, so i'm coding this override to a specific resource, a 
rider. 

The show action is rendering correctly, and i can enter my password. But 
when i submit the form i get the following error message 

    First argument in form cannot contain nil or be empty

I walked through the code with a debugger with watches for `@confirmable 
and self.resource` which are set in the `with_unconfirmed_confirmable and 
do_show` methods of the controller respectively, and it seems that while 
rendering the show template in the do_show method both @confirmable and 
self.resource are set to the user trying to confirm. However both are set 
to nil when updating the confirmation. 

I am storing the confirmation token in the form as a hidden field. It's set 
to the correct value (when i use it to query the db i get the user i 
expect). 

Once again walking through it with a debugger, I noticed that the value of 
the confirmation token seems to be regenerated to a different toke during 
the update action, but it's correct in the request parameters.

    
{"rider"=>{"confirmation_token"=>"92f786e5270e3562aa48589cc6c36e083cc7a23a41bb55f92c338f381050ec8b"},
 
"commit"=>"Activate", "controller"=>"riders/confirmations", 
"action"=>"update"}

Because of that @confirmable is being set to nil. 

So now i'm wondering why
    @confirmation_token = Devise.token_generator.digest(User, 
:confirmation_token, @original_token) generating a brand new token on 
update, when the value of @original_token seems to be the same (based on 
the watches in my debugger). 
 





-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to