0

I'm trying to add a simple select box and submit button to a "show" page in ActiveAdmin. Basically, the clients wants a simple way to assign a currently unassigned widget to the item currently being viewed. Not that that really matters.

What I am seeing is that although I can add a form and a select box, if I try to add anything after the select, the select doesn't get displayed. It's not that it is hidden by CSS, but that it just doesn't render.

Here's the relevant code:

column do
  panel "Devices without locations" do
    devices = Device.without_location
    form_tag add_device_admin_location_path do 
      select_tag(:device_id, options_from_collection_for_select(devices, :id, :name))
      submit_tag
    end
  end
end

The submit tag will be displayed, but the select will not. event if I put "foo" in there, only the "foo" will show up. The only time the select will show up is if there is nothing else in the block.

Update: Okay, so I've been able to work around this by concatenating the output together. It's not ideal, and I definitely feel dirty, but it works.

I tried using formtastic on this, but it appears to only accepts attributes from the model, this doesn't work: I'm updating the device, not the location.

This works, but if anyone has a more better way of doing this, I'd love to know.

1 Answer 1

1

i had the same issue, and moving form into app/views/admin/#{model_name}s/_#{partial_name}.html.erb worked for me fine

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.