1
0
Fork 0

Add action ProfilesController#index

This commit is contained in:
Alex Kotov 2021-03-10 14:55:59 +05:00
parent 6db791d5bb
commit fca3cfa071
3 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,8 @@
class ProfilesController < ApplicationController class ProfilesController < ApplicationController
def index
@profiles = Profile.all
end
def show def show
@profile = Profile.find params[:id] @profile = Profile.find params[:id]
end end

View File

@ -0,0 +1,9 @@
<h1>Profiles</h1>
<% if @profiles.present? %>
<ul>
<% @profiles.each do |profile| %>
<li><%= link_to profile.full_name, profile %></li>
<% end %>
</ul>
<% end %>

View File

@ -1,5 +1,5 @@
Rails.application.routes.draw do Rails.application.routes.draw do
root to: 'home#show' root to: 'home#show'
resources :profiles, only: :show resources :profiles, only: %i[index show]
end end