Quickfix micropost feed and policy

This commit is contained in:
Jesse C. Fisher 2023-11-15 16:23:23 +00:00 committed by TheNeedful-DO
parent 3ba380e63b
commit 3a18d741c2
3 changed files with 5 additions and 3 deletions

View File

@ -122,7 +122,7 @@ class User < ActiveRecord::Base
end
def feed
Micropost.where("user_id = ?", id)
microposts
end
end

View File

@ -46,10 +46,10 @@ class MicropostPolicy
end
def update?
@user.admin? || @user == @micropost.user
@user.admin? || @user == @micropost.micropostable
end
def destroy?
@user.admin? || @user == @micropost.user
@user.admin? || @user == @micropost.micropostable
end
end

View File

@ -18,6 +18,8 @@
= social_link.to_icon.html_safe
%p= profile.about
%span #{profile.followers.count} Followers
&nbsp;&nbsp;
%span #{profile.microposts.count} Posts
- if policy(profile).destroy?
= link_to 'Edit', edit_profile_path(profile)
= link_to 'Delete', profile, method: :delete, data: { confirm: 'Are you sure?' }