Skip to content

Commit

Permalink
wont create duplicate suggestables
Browse files Browse the repository at this point in the history
  • Loading branch information
James OKelly committed Apr 14, 2011
1 parent 37069f7 commit 722c95e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/acts_as_suggestable/acts_as_suggestable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ def suggest(suggestable, user)
EOS
raise Exception.new(msg) unless
suggestable.respond_to?(:is_suggestable?)


return nil if Suggestable.where(
:user_id => user.id,
:suggestion_id => suggestable.id,
:suggested_by_id => self.id
)

Suggestable.create(
:suggested_by => self,
:suggestion => suggestable,
Expand Down

0 comments on commit 722c95e

Please sign in to comment.