Home>

Currently, I am creating an EC site application at a programming school.
I want to transition to the cart list page (customer_cart_items_path), but the transition destination page has transitioned to the user my page (customer_customer_path (current_customer.id)).
If i check the code for transition
<% = link_to "cart", customers_cart_items_path%>
When you check the url of the transitioned screen,
"~/Customers/cart_items"
However, only html is loading the one on User My Page.

Which part should be modified to display the index.html of cart_items?
Thanks for your guidance.
(If i have any questions, we will reply in the comment section, so please contact us.)

↓ It is a log when transitioning. For some reason, "Processing by Customer :: CustomersController # show as HTML" is displayed, and I want to call the CurtItems controller, but the Customers controller has been called.

Started GET "/ customers/cart_items" for 119.231.101.229 at 2020-12-18 04:43:41 +0000
Processing by Customer :: CustomersController # show as HTML
  Parameters: {"id" =>"cart_items"}
  Customer Load (0.1ms) SELECT "customers". * FROM "customers" WHERE "customers". "Id" =? ORDER BY "customers". "Id" ASC LIMIT? [["Id", 1],

 ["LIMIT", 1]]
  Rendering customer/customers/show.html.erb within layouts/application
  Rendered customer/customers/show.html.erb within layouts/application (1.0ms)
  Rendered layouts/_login.html.erb (0.6ms)
Completed 200 OK in 32ms (Views: 28.1ms | ActiveRecord: 0.1ms)

↓ Cart_items is described from the 15th line from the bottom.

Rails.application.routes.draw do

  get'orders/index'
  get'orders/show'
  get'order/index'
  get'order/show'
  devise_for: administrator, controllers: {
    sessions:'administrators/sessions',
    passwords:'administrators/passwords',
    registrations:'administrators/registrations'
  }

  namespace: administrator do
    resources: genres, only: [: index,: create,: edit,: update,: show]
  end
  namespace: administrator do
    resources: customers
  end
  devise_for: customers, controllers: {
    sessions:'customers/sessions',
    passwords:'customers/passwords',
    registrations:'customers/registrations'
  }

  namespace: administrator do
    resources: products, only: [: index,: new,: create,: show,: edit,: update]
  end
 scope module :: customer do
    resources: customers, only: [: show,: edit,: update]
 end
  resources: shipping_addresses, only: [: index ,: create ,: edit ,: update ,: destroy]
  resources: products
  get'about' =>'customer/products # about'
  root: to =>"customer/products # top"get "/ homes/top" =>"homes # top"
  get "/ administrator/top" =>"administrator/products # top",: as =>"administrator_customer_top"

  resources: genres, only: [: index ,: create,: edit ,: update ,: show]
  get'administrator' =>"homes # administrator",: as =>"homes_administrator"
  get'administrator' =>"administrator # top",: as =>"administrator_top"
  get "/ customers/quit" =>"customers # quit", as:'customers_quit'
  put "/ customers/out" =>"customers # out", as:'customers_out'
  scope module :: customer do
    get'customers/products' =>'customer/products # index'
    get'customers/products /: id'=>'customer/products # show'

      resource: customers, only: [: show] do
          collection do
           get'quit'
           patch'out'
           end
         resources: cart_items, only: [: index ,: update ,: create,: destroy] do
        collection do
          delete'/' =>'cart_items # all_destroy'
        end
      end
    end
  end

  resources: customers, only: [: show,: edit,: update]
  namespace: administrator do
    resources: orders, only: [: index,: show,: update]
  end
  namespace: customer do
    resources: customers
  end
end

↓ The 9th line from the top is the code for transitioning to the cart list page.

<% if customer_signed_in?%><li><% = link_to "log out", destroy_customer_session_path, method:: delete%></li><li><% = link_to "My Page", customer_customer_path (current_customer.id)%></li><li><% = link_to "cart", customers_cart_items_path%></li><% else%><li><% = link_to "new registration", new_customer_registration_path%></li><li><% = link_to "login", new_customer_session_path%></li><li><% = link_to "top page", root_path%></li><% end%>

↓ It is index.html.erb of cart_items I want to display

<% provide (: title, "cart")%>Shopping cart     <% if @ cart_items.present?%>      <% = link_to "Empty cart", customers_cart_items_path, method:: delete, data: {confirm:'Are you sure I want to empty the cart? '},

 class: "glyphicon glyphicon-trash btn btn-danger"%>    <table>  <thead>    <tr>      <th>Product name</th>      <th>Unit price (tax included)</th>      <th>Quantity</th>      <th>Subtotal</th>      <th></th>    </tr>  </header>  <tbody>    <% @ cart_items.each do | cart_item |%>            <tr>        <% = render "quantity_form", cart_item: cart_item%>      </tr>    <% end%>  </tbody></table>              <% = link_to "Continue shopping", products_path, class: "glyphicon glyphicon-shopping-cart btn btn-info"%>                <table>    <thead>      <tr>        <td>Total amount</td>        <td>            \<% = Total_price (@cart_items) .to_s (: delimited)%>        </td>      </tr>    </header>  </table>          <% = link_to "Proceed to information entry", new_customers_order_path, data: {"turbolinks" =>false},

 class: "glyphicon glyphicon-pencil btn btn-success center-block"%>    <% else%>  <% = render "no_cart"%><% end%>