Skip validation on nested attribute

Hi, I have a two models, advert and address. An advert has one address.

On my advert form I have a nested form of the address. But I only want to create the nested address depending on the adver kind.

how can I skip the nested attribute validation?

I can do it in javascript on the submit event

Hi,

I have a two models, advert and address.

An advert has one address.

On my advert form I have a nested form of the address. But I only want

to create the nested address depending on the adver kind.

I think you can use this structure (copied from an app of mine)… you should be able to hack around with the :reject_if to do what you want:

accepts_nested_attributes_for :product_gsa_ldp_line_items, :reject_if => lambda { |a| a[:first_name].blank? a[:last_name].blank? }, :allow_destroy => true