date_select with both discard_day and include_blank may be broken in 3.2 #4633

Closed
hab opened this Issue Jan 23, 2012 · 3 comments

Comments

Projects
None yet
3 participants
@hab

hab commented Jan 23, 2012

I have a regression between Rails 3.1 and 3.2 that appears to be introduced by pull request #2086.

I have a form with a date_select like this:

   date_select 'bill', 'payment_month', discard_day: true, include_blank: true

In Rails 3.1 that worked fine as the multi-parameter conversion in ActiveRecord automatically added a 1 (one) for each missing parameter. However, Rails 3.2 (with pull request #2086) changed this behaviour to return nil if any of the multi-parameters were missing. That effectively means that it is no longer possible to use the above combination.

The date_select will provide a default day-value in a hidden field only if include_blank is false. A possible solution may be to change this behaviour to always add hidden fields with default values regardless of the include_blank parameter as it would simply be discarded now.

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Jan 23, 2012

Member

Could you try to add a falling test or open a pull request?

Member

rafaelfranca commented Jan 23, 2012

Could you try to add a falling test or open a pull request?

@hab

This comment has been minimized.

Show comment
Hide comment
@hab

hab Jan 24, 2012

I am not entirely sure where I should add a failing unit test. It is the combination of date_select and the multi-parameter conversion that fails for me.

The easy fix for my case would be to change date_select to add a value to the hidden day parameter but that would change a behavior that has not changed in years.

Can you give me a hint on what you would like to see?

hab commented Jan 24, 2012

I am not entirely sure where I should add a failing unit test. It is the combination of date_select and the multi-parameter conversion that fails for me.

The easy fix for my case would be to change date_select to add a value to the hidden day parameter but that would change a behavior that has not changed in years.

Can you give me a hint on what you would like to see?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Jan 24, 2012

Member

This issue is related with #4553. I'm taking a look in this

Member

rafaelfranca commented Jan 24, 2012

This issue is related with #4553. I'm taking a look in this

rafaelfranca added a commit to rafaelfranca/omg-rails that referenced this issue Jan 24, 2012

@josevalim josevalim closed this Jan 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment