Sha256: d417556e12caf8de0f069f957a6692a43bcb354978a8352d9863829f915adb4f
Contents?: true
Size: 583 Bytes
Versions: 13
Compression:
Stored size: 583 Bytes
Contents
module Para module Admin module NestedInputsHelper # Helper that allows filling a parent association for a given resource, based on the # inverse_of option of the parent resource association. # def with_inverse_association_for(resource, attribute_name, parent_resource) resource.tap do association_name = parent_resource.association(attribute_name).options[:inverse_of] return resource unless association_name resource.association(association_name).replace(parent_resource) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems