下記のコードのsample1のリンク先をapp/views/users/show.html.erbに設定したいです。
https://sample.com/users/1このようにログインidを持たせたURLで表示したいです。
app/views/layouts
<header> <%= link_to リンク先, :method => :HTTPメソッド do %>sample1 <% end %> <%= link_to users_path, :method => :GET do %>sample2 <% end %> </header>
app/controllers/users_controller.rb
class UsersController < ApplicationController def index end def show end def new end def create end private end
config/routes.rb
Rails.application.routes.draw do devise_for :users resources :users resources :users, only: [:show] end
rake routes
users GET /users(.:format) users#index POST /users(.:format) users#create new_user GET /users/new(.:format) users#new edit_user GET /users/:id/edit(.:format) users#edit user GET /users/:id(.:format) users#show PATCH /users/:id(.:format) users#update PUT /users/:id(.:format) users#update DELETE /users/:id(.:format) users#destroy GET /users/:id(.:format) users#show
現状上記のようなコードになっております。
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。