Don't validate nested attributes in rails -


i don't want validate & save nested attributes model while saving parent model.

class car   has_many :models   nested_attributes_for :models end  class model   belongs_to :car end  car = car.create(name: "tata") car.model_attributes({name: "nano"},{name: "vista"}) car.save! 

you can try setting :autosave false, prevent saving nested attributes

class car   has_many :models, autosave: false end 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -