Quickfix micropost feed and policy
This commit is contained in:
parent
3c95bf4859
commit
09b9d7ff22
@ -122,7 +122,7 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def feed
|
def feed
|
||||||
Micropost.where("user_id = ?", id)
|
microposts
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -46,10 +46,10 @@ class MicropostPolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update?
|
def update?
|
||||||
@user.admin? || @user == @micropost.user
|
@user.admin? || @user == @micropost.micropostable
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
@user.admin? || @user == @micropost.user
|
@user.admin? || @user == @micropost.micropostable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
= social_link.to_icon.html_safe
|
= social_link.to_icon.html_safe
|
||||||
%p= profile.about
|
%p= profile.about
|
||||||
%span #{profile.followers.count} Followers
|
%span #{profile.followers.count} Followers
|
||||||
|
|
||||||
|
%span #{profile.microposts.count} Posts
|
||||||
- if policy(profile).destroy?
|
- if policy(profile).destroy?
|
||||||
= link_to 'Edit', edit_profile_path(profile)
|
= link_to 'Edit', edit_profile_path(profile)
|
||||||
= link_to 'Delete', profile, method: :delete, data: { confirm: 'Are you sure?' }
|
= link_to 'Delete', profile, method: :delete, data: { confirm: 'Are you sure?' }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user