Posted over 5 years ago. Visible to the public.

all_blank_except for accepts_nested_attributes_for

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

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

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Martin Straub
Last edit:
10 months ago
by Thomas Eisenbarth
Attachments:
activerecord_base_reject_if_all_blank_except.rb
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Martin Straub to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more