parent
b17ef5fac7
commit
e4c1739fd9
@ -0,0 +1,9 @@ |
||||
class Profiles::FollowersController < ApplicationController |
||||
before_action :set_profile |
||||
|
||||
private |
||||
|
||||
def set_profile |
||||
@profile = Profile.find params[:profile_id] |
||||
end |
||||
end |
@ -0,0 +1,9 @@ |
||||
class Profiles::FollowingController < ApplicationController |
||||
before_action :set_profile |
||||
|
||||
private |
||||
|
||||
def set_profile |
||||
@profile = Profile.find params[:profile_id] |
||||
end |
||||
end |
@ -0,0 +1,11 @@ |
||||
<div class="my-4"> |
||||
<strong>❮ <%= link_to @profile.full_name, @profile %></strong> |
||||
</div> |
||||
|
||||
<% if @profile.following_profiles.present? %> |
||||
<ul> |
||||
<% @profile.following_profiles.each do |following_profile| %> |
||||
<li><%= link_to following_profile.full_name, following_profile %></li> |
||||
<% end %> |
||||
</ul> |
||||
<% end %> |
@ -0,0 +1,11 @@ |
||||
<div class="my-4"> |
||||
<strong>❮ <%= link_to @profile.full_name, @profile %></strong> |
||||
</div> |
||||
|
||||
<% if @profile.followed_profiles.present? %> |
||||
<ul> |
||||
<% @profile.followed_profiles.each do |followed_profile| %> |
||||
<li><%= link_to followed_profile.full_name, followed_profile %></li> |
||||
<% end %> |
||||
</ul> |
||||
<% end %> |
@ -1,5 +1,8 @@ |
||||
Rails.application.routes.draw do |
||||
root to: 'home#show' |
||||
|
||||
resources :profiles, only: %i[index show] |
||||
resources :profiles, only: %i[index show] do |
||||
resources :followers, controller: 'profiles/followers', only: :index |
||||
resources :following, controller: 'profiles/following', only: :index |
||||
end |
||||
end |
||||
|
Reference in new issue