On 4 November 2011 17:46, JavierQQ <[email protected]> wrote:
>
>
> On 4 nov, 12:31, Craig White <[email protected]> wrote:
>> On Nov 4, 2011, at 10:20 AM, JavierQQ wrote:
>>
>> still not entirely clear but I would think that you need to change...
>>
>> >>> validates_uniqueness_of :qnumber, :scope => :evaluation_id, :on => 
>> >>> :create
>>
>> to this...
>>
>> validates_uniqueness_of :qnumber
>>
>
> I'm doing that because I can create several evaluations and each
> evaluation has an id, that's why I'm scoping by evaluation_id
> I found in section 15 of the validation guide, something about
> Proc.new
> What I want to do with update is that when I hit save it first search
> if the number exists(with a where() I guess), if exist it shouldn't
> allow me to update
> if not, it will let me update the question

You are still being too vague about your requirement, for me anyway.
Can you write the validation test as pseudo code, being absolutely
clear about each reference there?  Ignore everything about the meaning
of the database fields and just write the validation requirement in
terms of data in the database and the new data about to be saved,
referencing just database fields.

Colin

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