On 4 November 2011 15:40, JavierQQ <[email protected]> wrote:
> Hi
>
> I hope someone can help me with this
>
> I have a model Question, and its controller .. what I've done to
> validate that there's no evaluation with 2 question with the same
> number is
>
>          validates_uniqueness_of :qnumber, :scope
> => :evaluation_id
>
> but when I try to update a question's content I got an error message
> that says that "#{qnumber} has already been taken"
> and that means that the validation works, but not as I want
>
> Can I obtain wich "def" is using ? because I want to do this
> - Question Model
>
>           IF ("def create" or something)
>                 do the validation
>           elsif ("def update")
>                 don't do it
>          end

I don't know what you mean by "def" but if you want to do conditional
validations have a look at the Rails Guide on validations and it will
show you how.

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