Validates uniqueness scope

In a Rails 2.x validation to check if the name of some model is unique
within a some category, I would use:

validates_uniqueness_of :name, :scope => :category_id

In Rails 3, this is replaced with:

validates :name, :uniqueness => true

However, I can’t seem to find a method of defining the uniqueness’
scope. Am I missing something?

Thanks,
Angelo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs