(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
end

...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.

--wpd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to