On Fri, Nov 4, 2011 at 16:27, Colin Law <[email protected]> wrote
to JavierQQ <[email protected]>:

> You are still being too vague about your requirement, for me anyway.

I think I grok what he wants and can express it briefly: the
*combination* of evaluation_id and qnumber, must be unique.

If that's right, then the Rails Guide on validation (and callbacks)
has a close example:

    validates :name, :uniqueness => { :scope => :year,
        :message => "should happen once per year" }

but the OP says that:

         validates_uniqueness_of :qnumber, :scope => :evaluation_id

isn't working, and IIUC should be equivalent to

         validates :qnumber, :uniqueness => { :scope => :evaluation_id }

Just in case I don't UC:

JavierQQ, try this:

    validates :qnumber, :uniqueness => { :scope => :evaluation_id,
        :message => "must be unique within each evaluation" }

in the model, and let us know what happens.  Don't worry about what
controller it's going through to get there.

-Dave

PS: As for top vs. bottom posting, another point of list etiquette
that some people have been violating is that if you change the
subject, change the Subject.  :-P

-- 
LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

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