From fca3cfa0716f6ce9188ae2ca9039cfc017b64909 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 10 Mar 2021 14:55:59 +0500 Subject: [PATCH] Add action ProfilesController#index --- app/controllers/profiles_controller.rb | 4 ++++ app/views/profiles/index.html.erb | 9 +++++++++ config/routes.rb | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 app/views/profiles/index.html.erb diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index d802715..b563090 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,4 +1,8 @@ class ProfilesController < ApplicationController + def index + @profiles = Profile.all + end + def show @profile = Profile.find params[:id] end diff --git a/app/views/profiles/index.html.erb b/app/views/profiles/index.html.erb new file mode 100644 index 0000000..52130c1 --- /dev/null +++ b/app/views/profiles/index.html.erb @@ -0,0 +1,9 @@ +

Profiles

+ +<% if @profiles.present? %> + +<% end %> diff --git a/config/routes.rb b/config/routes.rb index a03c68a..b3810bf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do root to: 'home#show' - resources :profiles, only: :show + resources :profiles, only: %i[index show] end