Hi,
In a Ruby on Rails 3 application, I have invitations. Here is the model:
class TeamInvitation < ActiveRecord::Base
belongs_to :team
validates :email, :presence => true, :format => RFC822::EMAIL
validates_uniqueness_of :email, :scope => :team_id
end
How can I refactor the uniqueness validation to include it into the validates method?
According to the documentation, the key :uniqueness
should be a boolean, but in my case i want specify the scope. How can I do that (if possible)?