{"action":"created","issue":{"url":"https://api.github.com/repos/plataformatec/devise/issues/2507","labels_url":"https://api.github.com/repos/plataformatec/devise/issues/2507/labels{/name}","comments_url":"https://api.github.com/repos/plataformatec/devise/issues/2507/comments","events_url":"https://api.github.com/repos/plataformatec/devise/issues/2507/events","html_url":"https://github.com/plataformatec/devise/issues/2507","id":16735273,"number":2507,"title":"Cannot use `devise_for` in Rails 4, complains \"already in use\"","user":{"login":"f3ndot","id":740289,"avatar_url":"https://avatars.githubusercontent.com/u/740289?v=3","gravatar_id":"","url":"https://api.github.com/users/f3ndot","html_url":"https://github.com/f3ndot","followers_url":"https://api.github.com/users/f3ndot/followers","following_url":"https://api.github.com/users/f3ndot/following{/other_user}","gists_url":"https://api.github.com/users/f3ndot/gists{/gist_id}","starred_url":"https://api.github.com/users/f3ndot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f3ndot/subscriptions","organizations_url":"https://api.github.com/users/f3ndot/orgs","repos_url":"https://api.github.com/users/f3ndot/repos","events_url":"https://api.github.com/users/f3ndot/events{/privacy}","received_events_url":"https://api.github.com/users/f3ndot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2013-07-14T23:28:40Z","updated_at":"2015-08-06T06:30:16Z","closed_at":"2013-07-15T00:31:51Z","body":"I'm attempting to write a custom controller ``app/controllers/users/registrations_controller.rb`` to perform additional checks on resource creation:\r\n\r\n```ruby\r\nclass Users::RegistrationsController < Devise::RegistrationsController\r\n  def new\r\n    super\r\n  end\r\n\r\n  def create\r\n    # my additional logic here\r\n    super\r\n  end\r\n\r\n  def update\r\n    super\r\n  end\r\nend\r\n```\r\n\r\nOf course, as per docs, I have to add the following to my ``config/routes.rb`` file:\r\n\r\n```ruby\r\ndevise_for :users, :controllers => { :registrations => \"users/registrations\" }\r\n```\r\n\r\nHowever using ``devise_for`` generates this error:\r\n\r\n```\r\nbundle exec rake routes --trace\r\n** Invoke routes (first_time)\r\n** Invoke environment (first_time)\r\n** Execute environment\r\nrake aborted!\r\nInvalid route name, already in use: 'new_user_session' \r\nYou may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: \r\nhttp://guides.rubyonrails.org/routing.html#restricting-the-routes-created\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:409:in `add_route'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1440:in `add_route'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1415:in `block in decomposed_match'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1306:in `block (2 levels) in member'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:718:in `scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1305:in `block in member'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1535:in `with_scope_level'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1304:in `member'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1415:in `decomposed_match'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:596:in `map_method'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:557:in `get'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:345:in `block in devise_session'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1087:in `block in resource'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1544:in `block (2 levels) in resource_scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:718:in `scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1543:in `block in resource_scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1535:in `with_scope_level'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1542:in `resource_scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1086:in `resource'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:344:in `devise_session'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:234:in `block (4 levels) in devise_for'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:234:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:234:in `block (3 levels) in devise_for'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:418:in `with_devise_exclusive_scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:233:in `block (2 levels) in devise_for'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:336:in `block in devise_scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:835:in `block in constraints'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:718:in `scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:835:in `constraints'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:335:in `devise_scope'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:224:in `block in devise_for'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:207:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.0/lib/devise/rails/routes.rb:207:in `devise_for'\r\n/Users/justinbull/Code/working-title-project/config/routes.rb:12:in `block in <top (required)>'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'\r\n/Users/justinbull/Code/working-title-project/config/routes.rb:1:in `<top (required)>'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'\r\n/Users/justinbull/Code/working-title-project/config/environment.rb:5:in `<top (required)>'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'\r\n/Users/justinbull/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `load'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `<main>'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'\r\n/Users/justinbull/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'\r\nTasks: TOP => routes => environment\r\n```\r\n\r\nI have not seen anyone else with this error. Has no one tried to write custom controllers in Rails 4 or have I horribly messed up?\r\n\r\nRails version: 4.0.0\r\nRuby version: 2.0.0-p247\r\nDevise version: 3.0.0\r\nWarden version: (~> 1.2.3)"},"comment":{"url":"https://api.github.com/repos/plataformatec/devise/issues/comments/128264895","html_url":"https://github.com/plataformatec/devise/issues/2507#issuecomment-128264895","issue_url":"https://api.github.com/repos/plataformatec/devise/issues/2507","id":128264895,"user":{"login":"vincelaunchlabs","id":11812072,"avatar_url":"https://avatars.githubusercontent.com/u/11812072?v=3","gravatar_id":"","url":"https://api.github.com/users/vincelaunchlabs","html_url":"https://github.com/vincelaunchlabs","followers_url":"https://api.github.com/users/vincelaunchlabs/followers","following_url":"https://api.github.com/users/vincelaunchlabs/following{/other_user}","gists_url":"https://api.github.com/users/vincelaunchlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/vincelaunchlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincelaunchlabs/subscriptions","organizations_url":"https://api.github.com/users/vincelaunchlabs/orgs","repos_url":"https://api.github.com/users/vincelaunchlabs/repos","events_url":"https://api.github.com/users/vincelaunchlabs/events{/privacy}","received_events_url":"https://api.github.com/users/vincelaunchlabs/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T06:30:16Z","updated_at":"2015-08-06T06:30:16Z","body":"Thanks! I didn't realise I also had a duplicate on devise_for :users.\r\n"}}