module Para::Ext::ActiveRecord::NestedAttributesClassMethods

Constants

PARA_REJECT_ALL_BLANK_PROC

Override default :reject_all proc to handle fake ids as empty keys, avoiding the model to be created with only its fake id.

Public Instance Methods

accepts_nested_attributes_for(*attr_names) click to toggle source

Intercept the ‘reject_if: :all_blank` option to also consider fake ids as blank fields and avoid empty params assignation

Calls superclass method
# File lib/para/ext/active_record_nested_attributes.rb, line 43
def accepts_nested_attributes_for(*attr_names)
  options = attr_names.extract_options!
  options[:reject_if] = PARA_REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank
  super(*attr_names, options)
end