Home>

I want to display the user sign-in screen at http: // localhost: 3000/users/sign_in.

Current status
The top screen is displayed as desired
When I try to transition to the sign-in screen, the top screen is displayed and no error message appears in the browser.

We are currently in the process of creating a simple application like SNS.
Arrange the outline layout with bootstrap and install devise. When I tried to enter the sign-in screen http: // localhost: 3000/users/sign_in after writing the routing, model, controller, and view, the top page remained.

Even if I try to enter http: // localhost: 3000/users/sign_in directly, it will enter the top page.
At the console

ActionController :: RoutingError (No route matches [GET] "/ users/sign_in% E3% 80% 80% E3% 81% A7% E3% 83% 88% E3% 83% 83% E3% 83% 97% E7% 94 % BB% E9% 9D% A2% E3% 81% AB% E8% A1% 8C% E3% 81% A3% E3% 81% A6% E3% 81% 97% E3% 81% BE% E3% 81% 86 "):


Message was out.

Corresponding source code
views/layouts/application.html.erb<! doctype html><html><head><!-Required meta tags-><meta charset = "utf-8"><meta name = "viewport" content = "width = device-width, initial-scale = 1, shrink-to-fit = no"><% = stylesheet_link_tag'application', media:'all','data-turbolinks-track':'reload'%><% = javascript_pack_tag'application','data-turbolinks-track':'reload'%></head><!-Bootstrap CSS-><link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity = "sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPux" anonymous ">
  <title>My rank</title></head><body>       Welcome to My Rank!   <p>Here, you can post the "personal ranking" that you think in your daily life or hobby and get sympathy from people with the same sensibility!</p>         Login or new registration      Logout or username      My rank top              Dummy image   <p>Some quick example text to build on the card title and make up the bulk of the card's content.</p>   Go somewhere     
  <script src = "https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity = "sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C + OGpamoFVy38MVBnE + IbbVYUew + OrCXaRkfj" cross origin = "anonymous"></script><script src = "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity = "sha384-ho + j7jyWK8fNQe + A12Hb8AhRq26LrZ/JpcUGGOn + Y7RsweNrtN/tE3MoK7ZeZDyx "crossorigin =" anonymous "></script></body></html>
views/devise/sessions/new.html.erb Log in<% = form_for (resource, as: resource_name, url: session_path (resource_name)) do | f |%><% = f.label: email%><br /><% = f.email_field: email, autofocus: true, autocomplete: "email"%>    <% = f.label: password%><br /><% = f.password_field: password, autocomplete: "current-password"%><% if devise_mapping.rememberable?%>      <% = f.check_box: remember_me%>  <% = f.label: remember_me%>  <% end%>  <% = f.submit "Log in"%><% end%><% = render "devise/shared/links"%>
routes.rb
Rails.application.routes.draw do
  devise_for: users
  root to: "posts # index"
end
What I tried

I reinstalled the device. The model and migration file have been recreated, and the login screen originally created with bootstrap has been changed to a simple teaching material.

Supplementary information

I think that there is a lack of information or points that are not reached in the first post, beginners.
I would like to ask the professor how to ask questions and how to think.

  • Answer # 1

    Answer with "guess".

    However,Go to the top screen withIs included in the URL of the error message,

    "/ users/sign_in% E3% 80% 80% E3% 81% A7% E3% 83% 88% E3% 83% 83% E3% 83% 97% E7% 94% BB% E9% 9D% A2% E3% 81% AB% E8 % A1% 8C% E3% 81% A3% E3% 81% A6% E3% 81% 97% E3% 81% BE% E3% 81% 86"

    What kind of URL was actually accessed?

    I'd like you to show me the controller, but in the first place, routesusers/sign_inThere is nothing about it, and first of all there. (If you can link with devise: users, unnecessary words are included in the URL, so actuallyusers/sign_inCan't accessI go to the top screen with/users/sign_inI am accessing with. )
    So, because I am using device, I think that it is judged that "non-existent URL = not authenticated" and redirected to the top page.
    How to deal with it depends on the design.