rails nested form still runs validations on destroyed fields

I have a nested form in which the user can dynamically add and delete fields through javascript like in this rails cast: http://railscasts.com/episodes/196-nested-model-form-revised?view=asciicast .

The user can click a link that will use javascript to destroy the field. The only problem is I have a validation on the field that still gets triggered, since the way the rails cast sets up the javascript simply has the field still submit but with a parameter like this:

'_destroy' => true 

so it is still validating it even though it will be destroyed. How do I get the rails to skip validation on destroyed fields?


Can you use this?

validates :field, unless: :marked_for_destruction?

Need Your Help

Can I configure iptables to choose a network interface to connect internet depending on destination IP?

linux iptables

Right now, in my ubuntu there are two network cards installed. One connects to a local area network (NIC 1) and the other is connected to internet (NIC2) . We have configured iptables to forward all

PHP and CPU - Process of chat + notifications

php cpu-usage

My site has a PHP process running, for each window/tab open, that runs in a maximum of 1 minute, and it returns notifications/chat messages/people online or offline. When JavaScript gets the output...