Quickfix micropost feed and policy
This commit is contained in:
parent
0a8cb9f131
commit
8905baa552
@ -122,7 +122,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def feed
|
||||
Micropost.where("user_id = ?", id)
|
||||
microposts
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -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
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
= social_link.to_icon.html_safe
|
||||
%p= profile.about
|
||||
%span #{profile.followers.count} Followers
|
||||
|
||||
%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?' }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user