You’re not receiving notifications from this thread.
accepts_nested_attributes_for and :reject_if
I have problem with nested attributes:.
class MainTransactionElement < ApplicationRecord has_one :external_source accepts_nested_attributes_for :external_source, :reject_if => :is_external_source_blank? end def is_external_source_blank? is_external_source_checkbox == '0' end
During the first load of form, it works. But is one bug:
- Checkbox is unchecked and form won't pass the validation and render again.
- In next render form doesn't generate nested attributes and I check checkbox.
- In next render, nested attributes still doesn't generate, despite the previously marked checkbox.
Any ideas why?