docbrown/app/policies/follow_policy.rb
Ben Halpern 651ab3ce35
Add point weights for tag follows (#1229)
* Add point weights for tag follows

* Adjust num articles to initially show up on home page

* Fix schema.rb

* Adjust follow policy spec

* Adjust dashboard styling for follow points form
2018-11-30 15:36:58 -05:00

19 lines
286 B
Ruby

class FollowPolicy < ApplicationPolicy
def create?
!user_is_banned?
end
def update?
user_is_follower?
end
def permitted_attributes
%i[points]
end
private
def user_is_follower?
record.follower_id == user.id && record.follower_type == "User"
end
end