(How?) Is it possible to use validates_uniqueness_of with a scope that is a belongs_to association?
This is what I would like to do:
class Lot < ActiveRecord::Base
belongs_to :part, :include => true
validates_uniqueness_of :identifier, :scope => :part
…but (not surprisingly) when I run my unit test, I get:
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: lots.part
Basically, I want to ensure that identifiers are unique for a given part.
I think I’m going to have to write my own validation here, but I thought I would ask the question first.