Add action ProfilesController#index
This commit is contained in:
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
|
||||
|
|
Reference in New Issue