Devise: Rails 4: undefined method 'attributes_for' for class `Devise::ParameterSanitizer' (NameError)

Created on 19 Apr 2016  路  3Comments  路  Source: heartcombo/devise

This is for Rails 4.2.6, Ruby 2.2.2 and devise greater than '3.5.7'

Full error:

/home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `attributes_for' for class `Devise::ParameterSanitizer' (NameError)
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/devise_invitable-1.5.2/lib/devise_invitable/parameter_sanitizer.rb:12:in `included'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/devise_invitable-1.5.2/lib/devise_invitable/rails.rb:20:in `include'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/devise_invitable-1.5.2/lib/devise_invitable/rails.rb:20:in `block in <class:Engine>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:36:in `call'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `each'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
    from /home/wayne/RubymineProjects/photoview/config/environment.rb:5:in `<top (required)>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
    from /home/wayne/RubymineProjects/photoview/config.ru:3:in `block in <main>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /home/wayne/RubymineProjects/photoview/config.ru:in `new'
    from /home/wayne/RubymineProjects/photoview/config.ru:in `<main>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/server.rb:61:in `app'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/server.rb:139:in `log_to_stdout'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/server.rb:78:in `start'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/wayne/RubymineProjects/photoview/bin/rails:8:in `require'
    from /home/wayne/RubymineProjects/photoview/bin/rails:8:in `<top (required)>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `load'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `call'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/lib/spring/client.rb:30:in `run'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/bin/spring:49:in `<top (required)>'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `load'
    from /home/wayne/.rvm/gems/ruby-2.2.2/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/wayne/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/wayne/RubymineProjects/photoview/bin/spring:13:in `<top (required)>'
    from /home/wayne/RubymineProjects/photoview/bin/rails:3:in `load'
    from /home/wayne/RubymineProjects/photoview/bin/rails:3:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
Needs more info

Most helpful comment

Sounds like a compat issue with devise_invitable. Have you tried running Devise 4 with devise_invitable from its git repo?

All 3 comments

Sounds like a compat issue with devise_invitable. Have you tried running Devise 4 with devise_invitable from its git repo?

devise-invitable 1.6.0 was released last week with support for devise 4 https://github.com/scambra/devise_invitable/commit/1df640a2aa14c0defb3a26f80d8cec5f3047949f

Maybe the .for method is deprecated check this >
http://stackoverflow.com/questions/38215274/devise-nomethoderror-for-parametersanitizer

This works for me

Was this page helpful?
0 / 5 - 0 ratings