Skip to content

Commit

Permalink
Simplifies Follower#follow.
Browse files Browse the repository at this point in the history
  • Loading branch information
james2m committed Sep 21, 2011
1 parent 38fc02b commit 080ea5b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/acts_as_follower/follower.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ def follow_count
# Creates a new follow record for this instance to follow the passed object.
# Does not allow duplicate records to be created.
def follow(followable)
follow = get_follow(followable)
if follow.blank? && self != followable
Follow.create(:followable => followable, :follower => self)
if self != followable
self.follows.find_or_create_by_followable_id_and_followable_type(followable.id, parent_class_name(followable))
end
end

Expand Down

0 comments on commit 080ea5b

Please sign in to comment.