I am using the user's mobile_phone_number as the "confirmation column" since i am writing a system that interacts using SMS (instead of emails).
The confirmation/reconfirmations was tied to :email field so I added two config parameters (kept the default on :email and :unconfirmed_email) so I can change the attribute from the Devise config file.
Define :confirmable_attribute and :unconfirmed_attribute options to c…
…hange the attribute used on reconfirmations (kept the :email/:unconfirmed_email as defaults)
This is not going to work. The module is included before the configuration options are applied.
Hmm... I get your point. I confess this caused me some problems during development, but at the end it passed all the tests (and it seems to be working correctly on my application). I could not figure out a way to test these other than just running the original devise tests.
I used the alias_attribute to keep the code cleaner. I was avoid the creation of the getter, setter and also the attribute_was and attribute present? methods.
Even if the tests are passing you would suggest the formal definition of the methods?
The tests are passing by accident. Add a new test that inherits from the Admin model and changes the value of confirmable_attribute and you will see the change won't propagate.
Hmmm true. I was changing the confirmable_attribute on the initializer config (and not on the model). I`ll make the changes and add more tests.
One thing feels odd here: this code is tied to send e-mails with tokens, since you don't send the e-mail, what are you doing? Overriding the delivery method to send a SMS?
Exactly. That felt super-odd on the headers_to method.
Defines confirmable/unconfirmed attribute access
Adds a new model MobileUser to test the confirmation on a different a…
Added the tests like you suggested and indeed the erros popped out. Defined the accessors (only the necessary ones).
But now i feel like this change is very specific to my application - Not really sure if it belongs on the master repository anyway.
So feel free to pull it or close it ;)
Thanks a lot for your patch but I believe it adds too much indirection, making the code harder to maintain. That said, I am closing this. Tks.