How do I access ActiveRecord :: AutosaveAssociation.marked_for_destruction? from within the parent model
I have a Person model, with the following association:
has_many :distributions accepts_nested_attributes_for :distributions, :allow_destroy => true validate :distributions_must_total_100
Custom checkout currently fails when it shouldn't - when some checks were marked for destruction - because they still show up in the "distributions" attributes (in memory, never mind what is in the db) before Face and its distributions are saved.
I would like to use
in my validator to ignore distributions that need to be destroyed.
How do I achieve this method? Not really sure if the distribution relation (your normal Rails model) applies to this class.
Is this an awful unclean hack? It feels a little messy and this is the most accurate solution to the problem.
source to share