ActionController::UrlGenerationError for devise registration controller
I'm running into an interesting ActionController::UrlGenerationError
while testing my custom devise User::RegistrationsController
Here's the error:
ActionController::UrlGenerationError:
No route matches {:action=>"create", :controller=>"user/registrations", :user=>{:name=>"Adriane Koepp", :city=>"Nidiafurt", :address=>"14955 Cormier Viaduct", :country=>"Mozambique", :email=>"moshe@kozey.com", :phone_primary=>"(295) 491-0447 x9108", :phone_secondary=>"536.985.9499 x7264", :postal_code=>"93438-7448", :province=>"South Carolina", :password=>"MaH9R5G8XqB", :pets_attributes=>[{:name=>"Patches", :chip_number=>"149793073311890", :species=>"iusto"}]}}
The error shows up in all my tests for this controller, but for simplicity, I'll only list one test for the create
action:
it 'creates a new User' do
expect do
post :create, params: { user: valid_attributes }
end.to change(User, :count).by(1)
end
The routes.rb
contains:
devise_for :users, controllers: {
registration: 'user/registration'
}
I can navigate to my registration page just fine at http://localhost:3000/users/sign_up
, but for some reason, my tests don't seem to think this controller has a valid URL for the create
action. Why so?
Additional steps
Upon following D1ceWard's suggestion, I pluralized "registration" in my routes, and now the error message changed to a AbstractController::ActionNotFound
error. I countered that by following the documentation and added the following block to the top of my tests:
before(:each) do
@request.env['devise.mapping'] = Devise.mappings[:user]
end
ruby-on-rails rspec devise rspec-rails
add a comment |
I'm running into an interesting ActionController::UrlGenerationError
while testing my custom devise User::RegistrationsController
Here's the error:
ActionController::UrlGenerationError:
No route matches {:action=>"create", :controller=>"user/registrations", :user=>{:name=>"Adriane Koepp", :city=>"Nidiafurt", :address=>"14955 Cormier Viaduct", :country=>"Mozambique", :email=>"moshe@kozey.com", :phone_primary=>"(295) 491-0447 x9108", :phone_secondary=>"536.985.9499 x7264", :postal_code=>"93438-7448", :province=>"South Carolina", :password=>"MaH9R5G8XqB", :pets_attributes=>[{:name=>"Patches", :chip_number=>"149793073311890", :species=>"iusto"}]}}
The error shows up in all my tests for this controller, but for simplicity, I'll only list one test for the create
action:
it 'creates a new User' do
expect do
post :create, params: { user: valid_attributes }
end.to change(User, :count).by(1)
end
The routes.rb
contains:
devise_for :users, controllers: {
registration: 'user/registration'
}
I can navigate to my registration page just fine at http://localhost:3000/users/sign_up
, but for some reason, my tests don't seem to think this controller has a valid URL for the create
action. Why so?
Additional steps
Upon following D1ceWard's suggestion, I pluralized "registration" in my routes, and now the error message changed to a AbstractController::ActionNotFound
error. I countered that by following the documentation and added the following block to the top of my tests:
before(:each) do
@request.env['devise.mapping'] = Devise.mappings[:user]
end
ruby-on-rails rspec devise rspec-rails
add a comment |
I'm running into an interesting ActionController::UrlGenerationError
while testing my custom devise User::RegistrationsController
Here's the error:
ActionController::UrlGenerationError:
No route matches {:action=>"create", :controller=>"user/registrations", :user=>{:name=>"Adriane Koepp", :city=>"Nidiafurt", :address=>"14955 Cormier Viaduct", :country=>"Mozambique", :email=>"moshe@kozey.com", :phone_primary=>"(295) 491-0447 x9108", :phone_secondary=>"536.985.9499 x7264", :postal_code=>"93438-7448", :province=>"South Carolina", :password=>"MaH9R5G8XqB", :pets_attributes=>[{:name=>"Patches", :chip_number=>"149793073311890", :species=>"iusto"}]}}
The error shows up in all my tests for this controller, but for simplicity, I'll only list one test for the create
action:
it 'creates a new User' do
expect do
post :create, params: { user: valid_attributes }
end.to change(User, :count).by(1)
end
The routes.rb
contains:
devise_for :users, controllers: {
registration: 'user/registration'
}
I can navigate to my registration page just fine at http://localhost:3000/users/sign_up
, but for some reason, my tests don't seem to think this controller has a valid URL for the create
action. Why so?
Additional steps
Upon following D1ceWard's suggestion, I pluralized "registration" in my routes, and now the error message changed to a AbstractController::ActionNotFound
error. I countered that by following the documentation and added the following block to the top of my tests:
before(:each) do
@request.env['devise.mapping'] = Devise.mappings[:user]
end
ruby-on-rails rspec devise rspec-rails
I'm running into an interesting ActionController::UrlGenerationError
while testing my custom devise User::RegistrationsController
Here's the error:
ActionController::UrlGenerationError:
No route matches {:action=>"create", :controller=>"user/registrations", :user=>{:name=>"Adriane Koepp", :city=>"Nidiafurt", :address=>"14955 Cormier Viaduct", :country=>"Mozambique", :email=>"moshe@kozey.com", :phone_primary=>"(295) 491-0447 x9108", :phone_secondary=>"536.985.9499 x7264", :postal_code=>"93438-7448", :province=>"South Carolina", :password=>"MaH9R5G8XqB", :pets_attributes=>[{:name=>"Patches", :chip_number=>"149793073311890", :species=>"iusto"}]}}
The error shows up in all my tests for this controller, but for simplicity, I'll only list one test for the create
action:
it 'creates a new User' do
expect do
post :create, params: { user: valid_attributes }
end.to change(User, :count).by(1)
end
The routes.rb
contains:
devise_for :users, controllers: {
registration: 'user/registration'
}
I can navigate to my registration page just fine at http://localhost:3000/users/sign_up
, but for some reason, my tests don't seem to think this controller has a valid URL for the create
action. Why so?
Additional steps
Upon following D1ceWard's suggestion, I pluralized "registration" in my routes, and now the error message changed to a AbstractController::ActionNotFound
error. I countered that by following the documentation and added the following block to the top of my tests:
before(:each) do
@request.env['devise.mapping'] = Devise.mappings[:user]
end
ruby-on-rails rspec devise rspec-rails
ruby-on-rails rspec devise rspec-rails
edited Nov 21 '18 at 10:15
Upvote Me
asked Nov 21 '18 at 9:18
Upvote MeUpvote Me
1,86521239
1,86521239
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Your error is caused by missing pluralization, devise
don't know what registration
is, but work with registrations
.
Solution :
# routes.rb
devise_for :users, controllers: {
registrations: 'user/registrations'
}
You can use rails routes
to check all existings routes.
Devise doc about custom controllers
Hrm, it definitely did something. I now getAbstractController::ActionNotFound
. Adding details to the question.
– Upvote Me
Nov 21 '18 at 10:05
1
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408725%2factioncontrollerurlgenerationerror-for-devise-registration-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your error is caused by missing pluralization, devise
don't know what registration
is, but work with registrations
.
Solution :
# routes.rb
devise_for :users, controllers: {
registrations: 'user/registrations'
}
You can use rails routes
to check all existings routes.
Devise doc about custom controllers
Hrm, it definitely did something. I now getAbstractController::ActionNotFound
. Adding details to the question.
– Upvote Me
Nov 21 '18 at 10:05
1
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
add a comment |
Your error is caused by missing pluralization, devise
don't know what registration
is, but work with registrations
.
Solution :
# routes.rb
devise_for :users, controllers: {
registrations: 'user/registrations'
}
You can use rails routes
to check all existings routes.
Devise doc about custom controllers
Hrm, it definitely did something. I now getAbstractController::ActionNotFound
. Adding details to the question.
– Upvote Me
Nov 21 '18 at 10:05
1
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
add a comment |
Your error is caused by missing pluralization, devise
don't know what registration
is, but work with registrations
.
Solution :
# routes.rb
devise_for :users, controllers: {
registrations: 'user/registrations'
}
You can use rails routes
to check all existings routes.
Devise doc about custom controllers
Your error is caused by missing pluralization, devise
don't know what registration
is, but work with registrations
.
Solution :
# routes.rb
devise_for :users, controllers: {
registrations: 'user/registrations'
}
You can use rails routes
to check all existings routes.
Devise doc about custom controllers
answered Nov 21 '18 at 9:47
D1ceWardD1ceWard
590312
590312
Hrm, it definitely did something. I now getAbstractController::ActionNotFound
. Adding details to the question.
– Upvote Me
Nov 21 '18 at 10:05
1
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
add a comment |
Hrm, it definitely did something. I now getAbstractController::ActionNotFound
. Adding details to the question.
– Upvote Me
Nov 21 '18 at 10:05
1
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
Hrm, it definitely did something. I now get
AbstractController::ActionNotFound
. Adding details to the question.– Upvote Me
Nov 21 '18 at 10:05
Hrm, it definitely did something. I now get
AbstractController::ActionNotFound
. Adding details to the question.– Upvote Me
Nov 21 '18 at 10:05
1
1
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
Wait, nevermind, I had to follow more documentation, but that was the solution. Thank you :) I'll complete the answer.
– Upvote Me
Nov 21 '18 at 10:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408725%2factioncontrollerurlgenerationerror-for-devise-registration-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown