Ludovic
Ludovic

Reputation: 2002

Devise, Rails 4 and routing error

I got a strange error with my rails 4.0.0 app with devise 3.1.1 when launching server or rake routes

Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: 
# <Rails::Application::RoutesReloader:0x000000044f5e80 
@paths=["/opt/web/devise/config/routes.rb"], 
@route_sets=[#<ActionDispatch::Routing::RouteSet:0x000000045ce190>]>

My routes.rb

devise_for :users, :path => "/", :path_names => { 
  :sign_in => "signin", 
  :sign_out => "signout", 
  :sign_up => "signup"
}

My application_controler.rb

before_filter :configure_strong_parameters, if: :devise_controller?
...
protected
  def configure_strong_parameters
    devise_parameter_sanitizer.for(:sign_up) << :gender, :name, :lastname, :birthday, :country
  end

My users_controler.rb

private

  def user_params
    params.require(:user).permit(:pseudo, :email, :gender, :name, :lastname, :birthday, :password, :password_confirmation, :country)
  end

My User.rb

devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

I try to remove the gem, remove devise.rb initializer and reinstall it, no changes.

Upvotes: 0

Views: 161

Answers (1)

JCC
JCC

Reputation: 463

Try this:

I was running into this issue today. Rails 4.0.0 and devise 3.10.

The problem started when I added to the User.rb in the model. Apparently, you have the leave the devise generated stuff at the top and alone, and put whatever changes you want BELOW that or else you will get this error.

If this doesn't work try regenerating the user.rb by using the rails g devise User again and then leaving the default stuff alone at the top and then placing whatever new code you want below that.

BTW, the default should look like this:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

***Put your code here***
end

Upvotes: 1

Related Questions