I have the following code:
class Like < ActiveRecord::Base
belongs_to :site
validates_uniqueness_of :ip_address, :scope => [:site_id]
end
Which limits a person from "liking" a site more than one time based on a remote ip request. Essentially when someone "likes" a site, a record is created in the Likes table and I use a hidden field to request and pass their ip address to the :ip_address column in the like table. With the above code I am limiting the user to one "like" per their ip address. I would like to limit this to a certain number for instance 10.
My initial thought was do something like this:
validates_uniqueness_of :ip_address, :scope => [:site_id, :limit => 10]
But that doesn't seem to work. Is there a simple syntax here that will allow me to do such a thing?