Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors after removing confirmable #397

Closed
Andrew-Max opened this issue Oct 5, 2015 · 5 comments
Closed

Errors after removing confirmable #397

Andrew-Max opened this issue Oct 5, 2015 · 5 comments

Comments

@Andrew-Max
Copy link

seems exactly like : #58 although that issue was marked as resolved and I still see the error.

I removed devise :confirmable

and removed the confirmable lines from the migration by hand. Afterwards i see NameError: undefined local variable or method confirmed_at'`

as suggested in the other issue, adding the lines

  def confirmed_at
      DateTime.now
  end

  def confirmed_at=(val)
  end

To the my user model solves the problem but I would prefer to avoid this give that it is hacky

@fabiancarlos
Copy link

Yeah, mee to! Someone solved?

@MarketingAjay
Copy link

@Andrew-Max @fabiancarlos I just ran into the same issue. The problem happens if your include statement is BEFORE the devise statement. This is unfortunate because the generator puts it at the top of the model by default. Switch the order and you should be good.

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  include DeviseTokenAuth::Concerns::User
end

@jeryRazakarison
Copy link
Contributor

Hi, I have a different error, while removing :confirmable from the devise statement.
I'm on Rails 5 beta, using Devise master branch, and devise_token_auth master branch.

When I make the post request, I have an error 500

And here is the stack

    Completed 500 Internal Server Error in 78ms (ActiveRecord: 0.0ms)
ArgumentError (After create callback :send_on_create_confirmation_instructions has not been defined):
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:641:in `block (2 levels) in skip_callback'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:637:in `each'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:637:in `block in skip_callback'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:568:in `block in __update_callbacks'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:566:in `reverse_each'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:566:in `__update_callbacks'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:636:in `skip_callback'
  /Users/jery/.rvm/gems/ruby-2.2.2/bundler/gems/devise_token_auth-d154b0294006/app/controllers/devise_token_auth/registrations_controller.rb:39:in `create'
  actionpack (5.0.0.beta1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
  actionpack (5.0.0.beta1) lib/abstract_controller/base.rb:183:in `process_action'
  actionpack (5.0.0.beta1) lib/action_controller/metal/rendering.rb:30:in `process_action'
  actionpack (5.0.0.beta1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:126:in `call'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:126:in `call'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:455:in `call'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:455:in `call'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
  activesupport (5.0.0.beta1) lib/active_support/callbacks.rb:90:in `run_callbacks'

(When I put :confirmable back in place, it works well).

Looking at rails/callback.rb l.630, it seems that

An ArgumentError will be raised if the callback has not already been set (unless the :raise option is set to false).

Does anyone have an idea how to fix this?

Thank you very much for your help.

@zachfeldman
Copy link
Contributor

Seems like the related issue has a possible fix, so closing for now.

@Herz3h
Copy link

Herz3h commented Nov 29, 2017

@MarketingAjay I accidently put the include concern first and it caused this problem. I had no idea why it was asking for confirmable even tho i removed that from my user model. Thanks for the fix, works perfectly !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants