Hi Guys! Im a newbie in using cocoon. i would like to ask your help in my issue below. I am using collection_check_boxes in nested-form. I cannot get the value of operator_contact.operator_contact_details.template to pass in checked. Hope you can help me. thank you.
model OperatorContact
class OperatorContact < ApplicationRecord
has_many :operator_contact_details, inverse_of: :operator_contact, dependent: :destroy
accepts_nested_attributes_for :operator_contact_details, reject_if: :all_blank, allow_destroy: true
end
model OperatorContactDetail
class OperatorContactDetail < ApplicationRecord
audited
belongs_to :operator_contact
serialize :template, Array
end
controller OperatorContactsController
class OperatorContactsController < ApplicationController
before_action :set_operator_contact, only: %i[ show edit update destroy ]
before_action :list_templates
private
def set_operator_contact
@operator_contact = OperatorContact.find(params[:id])
@operator_contact_details = @operator_contact.operator_contact_details
end
def list_templates
@all_templates = Template.where(status: true)
end
end
Hi Guys! Im a newbie in using cocoon. i would like to ask your help in my issue below. I am using collection_check_boxes in nested-form. I cannot get the value of operator_contact.operator_contact_details.template to pass in checked. Hope you can help me. thank you.
model OperatorContact
model OperatorContactDetail
controller OperatorContactsController
_form.html.erb
_operator_contact_detail_fields.html.erb
Error that I'm getting when I view or edit the record. I have no issue in creating new record.