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

Multiple choice selection box param values returned as array of arrays #649

Closed
hoenth opened this issue Feb 27, 2012 · 6 comments
Closed

Comments

@hoenth
Copy link

hoenth commented Feb 27, 2012

I recently began getting an error when running Cucumber specs where a multipart form returned a selection_collection field with multiple => true.

In my case, the selection_collection field relates an object to a habtm relationship.

      = f.collection_select :category_ids, categories, :id, :name, {}, :multiple => true

where f is a form for a Cause object.

When the spec hits the controller statement that saves the Cause object, I get the following error:

Couldn't find Category with ID=0 (ActiveRecord::RecordNotFound)
./app/controllers/admin/causes_controller.rb:16:in update' <internal:prelude>:10:insynchronize'

When I run the same spec using Selenium (setting the @javascript tag) the spec passes.

When run without selenium (and no options in the category_ids field selected), the params object contains:
"category_ids"=>["[""]"]

When run with selelenium, the params object contains:
"category_ids"=>[""]

I have checked the params function in the Capybara::RackTest::Form class and it appears to be correctly returning an array with a single empty string.

I also checked in the Rack::Test module, but can't discern whether the switch to an array of arrays is happening there, or within Capybara (or somewhere else, for that matter).

@jnicklas
Copy link
Collaborator

Are you on the latest version of everything? Rack, RackTest, Capybara, Cucumber, etc. I'm pretty sure this should be fixed.

@hoenth
Copy link
Author

hoenth commented Feb 27, 2012

Perhaps not. Here is what I am using. Do any seem out of date.

rails 3.0.7

capybara (1.1.2)
cucumber (1.0.2)
cucumber-rails (1.0.2)

rack (1.2.5)
rack-mount (0.6.14)
rack-rewrite (1.0.2)
rack-test (0.5.7)

@hoenth
Copy link
Author

hoenth commented Feb 27, 2012

I just updated to cucumber 1.0.6, but no luck.

@jnicklas
Copy link
Collaborator

The latest release of Rack is at 1.4.1, RackTest at 0.6.1. You're out of date on both fronts. Please upgrade these and see if that fixes anything.

@hoenth
Copy link
Author

hoenth commented Mar 5, 2012

Unfortunately, rails 3.0.11, which is what our project is still using, requires rack ~> 1.2.1, so I can't yet upgrade to rack 1.4.1

@jnicklas
Copy link
Collaborator

jnicklas commented Mar 5, 2012

You should really upgrade to Rails 3.1. If you switch off the asset pipeline, there are hardly any incompatibilities. Unfortunately we can't fix this bug in Capybara, so you'll have to either upgrade or switch to a different driver.

@jnicklas jnicklas closed this as completed Mar 5, 2012
@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants