Read more

all_blank_except for accepts_nested_attributes_for

Martin Straub
March 19, 2014Software engineer at makandra GmbH

Put the attached file to config/initalizers to ignore some fields for rejecting nested records (e.g. hidden input fields).

class Post < ActiveRecord::Base
  
  has_many :comments
  accepts_nested_attributes_for :comments, :reject_if => all_blank_except(:position, :other_nested_attrs)

end
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot
Posted by Martin Straub to makandra dev (2014-03-19 15:11)