Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass an array through params #974

Closed
exAspArk opened this issue Oct 17, 2013 · 1 comment
Closed

Pass an array through params #974

exAspArk opened this issue Oct 17, 2013 · 1 comment

Comments

@exAspArk
Copy link

Hi! How may I pass the array of arrays to collection?

When I'm trying to do like this:

f.input :ids_in, as: :check_boxes, collection: [
  ['arr1', [1, 2, 3]],
  ['arr2', [4, 5, 6]]
]

I get ids = ["1 2 3"].

Maybe formtastic could recognize the array and somehow populate the inputs?

if choice.kind_of?(Array)
  choice.each do |choice_item|
     builder.check_box_tag(...) 
     # hidden_field_tag 'model[ids][]', value, id: "model_ids_#{value}"
  end
end
@justinfrench
Copy link
Member

I'm not exactly sure what you're expecting as HTML output. If you could create a pull request with a few failing specs to illustrate your idea, I'd be happy to help make progress. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants