Permalink
Browse files

stop multiple bids on the same item

  • Loading branch information...
1 parent 37d4a7c commit abe275890e1726177f3ec6aecb57678042d341c8 @alexhocksween alexhocksween committed Dec 11, 2011
Showing with 2 additions and 1 deletion.
  1. +1 −1 app/controllers/bids_controller.rb
  2. +1 −0 app/models/bid.rb
@@ -9,7 +9,7 @@ def create
if @bid.save
redirect_to root_url, :alert => 'Your bid has been submitted successfully...'
else
-
+ redirect_to root_url, :alert => 'You have already bid on that item...'
end
end
end
View
@@ -1,2 +1,3 @@
class Bid < ActiveRecord::Base
+ validates_uniqueness_of :user_id, :scope => :offer_id
end

0 comments on commit abe2758

Please sign in to comment.