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

1.6.x: can't add a new key into hash during iteration #496

Closed
nateberkopec opened this issue Jan 20, 2015 · 3 comments
Closed

1.6.x: can't add a new key into hash during iteration #496

nateberkopec opened this issue Jan 20, 2015 · 3 comments

Comments

@nateberkopec
Copy link

I think 1.6.0 broke multiparameter attributes like dates. Given a form like:

 <%= f.date_select :start_time_gteq %>

...where start_time is a DateTime, it looks like collapse_multiparameter_attributes tries to modify a hash in an iteration. I believe this was introduced by ee571fe.

Here's the relevant stacktrace lines:

active_support/hash_with_indifferent_access.rb:97:in `[]='
    regular_writer(convert_key(key), convert_value(value, for: :assignment))
  active_support/hash_with_indifferent_access.rb:97:in `[]='
    regular_writer(convert_key(key), convert_value(value, for: :assignment))
  ransack/search.rb:167:in `block in collapse_multiparameter_attributes!'
    attrs[real_attribute] ||= []
  ransack/search.rb:156:in `each_key'
    attrs.each_key do |k|
  ransack/search.rb:156:in `collapse_multiparameter_attributes!'
    attrs.each_key do |k|
  ransack/search.rb:47:in `build'
    collapse_multiparameter_attributes!(params).each do |key, value|
  ransack/search.rb:39:in `initialize'
    build(params.with_indifferent_access)
@nateberkopec nateberkopec changed the title 1.6.2: can't add a new key into hash during iteration 1.6.x: can't add a new key into hash during iteration Jan 20, 2015
@jonatack
Copy link
Contributor

Thank you! You are correct. Reverted.

jonatack added a commit that referenced this issue Jan 21, 2015
@jonatack
Copy link
Contributor

Test added and change log updated. Thanks again @nateberkopec 😃

@nateberkopec
Copy link
Author

👍 !

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