1
0
Fork 0

Add action ProfilesController#index

master
Alex Kotov 2 years ago
parent 6db791d5bb
commit fca3cfa071

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

@ -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 %>

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