Skip to content

[BUG] #495

@antarr

Description

@antarr

Describe the bug
When using as: :tags, the current value is not selected.

Expected behavior
When I go to edit a record the current values for in my list should be render.

Screenshots

show(with current values)

image

edit(values missing)

image

Code

  controller do
    def update
      committee = LegiscanModel::Committee.friendly.find(params[:id])
      committee.people = LegiscanModel::Politician.where(people_id: params[:legiscan_model_committee][:people_ids])
      committee.save
      super
    end
  end

  permit_params :name, :state_id, :slug, :people_ids, :committee_id
  form do |f|
    f.inputs do
      f.input :name, input_html: { disabled: true }
      f.input :slug, input_html: { disabled: true }
      f.input :people_ids,
        label: 'Members',
        as: :tags,
        collection: LegiscanModel::Politician.where(state_id: f.object.state_id).order(:last_name),
        fields: [:full_name]
    end
    f.actions
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions