I am making a twitter demo app with reference to Progate.
When I press the new user registration button, the following error appears.
Corresponding source code
Routing Error No route matches [GET] "/ users"
Rails.application.routes.draw do post "users/create" =>"users # create" get "signup" =>"users # new" get "users/index" =>"users # index" get "users /: id" =>"users # show" get'posts/index'=>'posts # index' get'posts/new'=>'posts # new' get'posts /: id'=>'posts # show' post'posts/create'=>'posts # create' get'posts /: id/edit'=>'posts # edit' post'posts /: id/update'=>'posts # update' post'posts /: id/destroy'=>'posts # destroy' get'/' =>'home # top' # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html end
What I tried
class UsersController</pre> <pre><code data-language = "Ruby"> New user registration <% = form_tag ("/ users/create") do%> <p>username</p> <input name = "name"> <p>Email address</p> <input name = "email"> <input type = "submit" value = "new registration"> <% end%>
I tried searching for an error, but it didn't work.
After pressing the new user registration button, the above error appears, but the user registration itself has been completed. ..
There is no problem with the operation of new posts, user list, and user post screens.
Answer # 1
Routs about users
get "users/index" =>"users # index"
get "users /: id" =>"users # show"
Since there is only one, "/ users" is undefined.
get "users/index" =>"users # index"
get "users" =>"users # index"
So then the error disappears.
I think it's better to use resouces
- ruby on rails - rspec validation error
- ruby on rails - i want to resolve rails name error
- ruby on rails - rails error (logged out users see links that are no longer valid)
- ruby - [rails] implementation of sending registration completion email
- ruby on rails - pg :: datatypemismatch error when doing heroku run rails db: migrate
- ruby on rails - when i run rails, i get an error related to webpacker
- ruby on rails - i want to download a file with rails, s3 and carrierwave, but i get an error
- ruby - when i try to update rails, i get a routing error
- ruby on rails 6 - i want to solve the error that occurred while implementing the product listing function
- ruby - an error occurs when building a rails 6 environment with docker
- ruby on rails - error when implementing rails6 follow function
- ruby on rails 6 - about rails error "wrong number of arguments (given 1, expected 0)"
- ruby - [rails] about the error that occurs when deleting likes (routing error)
- ruby on rails - rails db registration activerecord :: associationtypemismatch in friendscontroller # create
- ruby on rails 6 - [error] nomethoderror in communitiescontroller # create undefined method `published?'for # <community: 0x0
- ruby on rails - i get an error without being created
- ruby on rails 6 - [error] uninitialized constant user (call'userconnection' to establish a connection) :: image
- ruby on rails - unknown action error when trying to post a comment
- ruby on rails - i want to put what i posted on the show page, but it's a blank page it's not an error
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable