I have tried tuning my Devise
views and have replaced email by username. For sure, I have adjusted initializers/devise.rb
by replacing all the occurences of :email
by :username
. I adjusted screens and things were working fine until I tried to delete the field email
from database.
After having done this, I am still able to login and create accounts as desired by using my new key (username), yet, when trying to update the user, I am getting this error message stating that email method is not defined.
I understand that I am missing a place from where to take a call to this non-existing attribute/method but, I don't know where....
Some logs:
NoMethodError in Devise::RegistrationsController#update
undefined method `email' for #<User...
Rails.root: /vagrant/src/projectX
Application Trace | Framework Trace | Full Trace
activemodel (4.0.1) lib/active_model/attribute_methods.rb:439:in `method_missing'
activerecord (4.0.1) lib/active_record/attribute_methods.rb:155:in `method_missing'
activemodel (4.0.1) lib/active_model/validator.rb:151:in `block in validate'
activemodel (4.0.1) lib/active_model/validator.rb:150:in `each'
activemodel (4.0.1) lib/active_model/validator.rb:150:in `validate'
activerecord (4.0.1) lib/active_record/validations/presence.rb:5:in `validate'
activesupport (4.0.1) lib/active_support/callbacks.rb:283:in `_callback_before_13'
activesupport (4.0.1) lib/active_support/callbacks.rb:377:in `_run__265703777__validate__callbacks'
activesupport (4.0.1) lib/active_support/callbacks.rb:80:in `run_callbacks'
Just needed to adjust User model adding the following:
def email_required? false end
def email_changed? false end