# Problem with date\_select after Rails 2.1 upgrade

**URL:** <https://www.ruby-forum.com/t/problem-with-date-select-after-rails-2-1-upgrade/141539>\
**Category:** Rails\
**Created:** [June 26, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/problem-with-date-select-after-rails-2-1-upgrade/141539 "2008-06-26T21:24:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Billy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@Billy\_G](https://www.ruby-forum.com/u/Billy_G)\
**Post date:** [June 26, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/problem-with-date-select-after-rails-2-1-upgrade/141539/1 "2008-06-26T21:24:53Z")

</div>

Folks,

I think I should start a new thread for this, because a similar one I  
saw is a bit old and the resolution there doesn’t seem to apply to  
what I’m running into now.

Anyway, my date\_select calls are bombing on me with the exception:

* * *

ActionView::TemplateError (wrong number of arguments (3 for 2)) on  
line #8 of entries/\_dates\_form.haml:  
8: = date\_select( ‘context’, ‘start\_date’, {:start\_year =\>  
2007, :order =\> [:month, :day, :year], :use\_short\_month =\>  
true, :include\_blank =\> false})

```
vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb:

```

## 655:in `select_year' vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb: 655:in`send’ vendor/rails/actionpack/lib/action\_view/helpers/date\_helper.rb: 655:in `date\_or\_time\_select’ …

If I dig into DateHelper with the debugger, this appears to be the  
line that’s bombing out:

/Users/wgray/Documents/Sources/Rails/tempo/vendor/rails/actionpack/lib/  
action\_view/helpers/date\_helper.rb:655  
date\_or\_time\_select.insert(0, self.send(“select\_#{param}”, datetime,  
options\_with\_prefix(position[param], options.merge(:use\_hidden =\>  
discard[param])), html\_options))

(rdb:1) eval self.send(“select\_#{param}”, datetime,  
options\_with\_prefix(position[param], options.merge(:use\_hidden =\>  
discard[param])), html\_options)  
ArgumentError Exception: wrong number of arguments (3 for 2)

I can’t seem to find a way to step into, or down into select\_year  
without the exception bubbling up on me and ending the investigation.  
Using step gets me to the end of otpions\_with\_prefix, but when I come  
back up, I can only seem to execute the send call, which then bombs.  
But anyway, my call to date\_select is nothing weird, and I have no  
plugins over-riding its behavior:

```
= date_select( 'context', 'start_date', {:start_year =>

```

2007, :order =\> [:month, :day, :year], :use\_short\_month =\>  
true, :include\_blank =\> false})

Nothing fancy. Anybody know what might have changed since Rails 2.0.2  
to cause this?

Regards,  
Billy

---

<div class="post-metadata">

**Author:** ![Billy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@Billy\_G](https://www.ruby-forum.com/u/Billy_G)\
**Post date:** [June 26, 2008, 9:33pm UTC](https://www.ruby-forum.com/t/problem-with-date-select-after-rails-2-1-upgrade/141539/2 "2008-06-26T21:33:40Z")

</div>

> ArgumentError Exception: wrong number of arguments (3 for 2)
> 
> I can’t seem to find a way to step into, or down into select\_year  
> without the exception bubbling up on me and ending the investigation.  
> Using step gets me to the end of otpions\_with\_prefix, but when I come  
> back up, I can only seem to execute the send call, which then bombs.  
> But anyway, my call to date\_select is nothing weird, and I have no  
> plugins over-riding its behavior:

But are their plugins overriding some other ActionView internals? Just  
about everytime someone has had similar problems its always turned out  
to be a plugin or monkey patch to some internal function.

Fred

---

<div class="post-metadata">

**Author:** ![Billy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@Billy\_G](https://www.ruby-forum.com/u/Billy_G)\
**Post date:** [June 26, 2008, 10:19pm UTC](https://www.ruby-forum.com/t/problem-with-date-select-after-rails-2-1-upgrade/141539/3 "2008-06-26T22:19:29Z")

</div>

So I went looking further, because as you say, that definitely sounds  
like the problem.

Aaaand D’OH! We had a monkey patch for select\_year at the bottom of  
application\_helper.rb 😉

I’ve moved that bad boy over to initializers/date\_helper.rb with our  
other patches and added the third html\_options param, works like a  
charm now.

Thanks Frederick!

On Jun 26, 3:33 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
