# Rails 2.1 and ddatetime\_select

**URL:** <https://www.ruby-forum.com/t/rails-2-1-and-ddatetime-select/139923>\
**Category:** Rails\
**Created:** [June 9, 2008, 6:55am UTC](https://www.ruby-forum.com/t/rails-2-1-and-ddatetime-select/139923 "2008-06-09T06:55:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 9, 2008, 6:55am UTC](https://www.ruby-forum.com/t/rails-2-1-and-ddatetime-select/139923/1 "2008-06-09T06:55:19Z")

</div>

I’ve updated to 2.1 and am continuing to have issues with  
datetime\_select helpers which worked fine previously.

Example:  
\<% form\_remote\_tag(:url =\> { :controller =\> ‘notes’,  
:action  
=\> :add\_booking\_note\_ajax,  
:id =\> @booking},  
:html  
=\>{:id=\>‘new\_booking\_note’}) do %\>  
\<%= datetime\_select(:note, :follow\_up, :discard\_second =\>  
true, :minute\_step =\> 15) %\>  
\<%= text\_area ‘note’, ‘body’, :rows =\> “7” %\>  
\<%= submit\_tag ‘Save’%\>  
\<% end %\>

Results in: ActionView::TemplateError (wrong number of arguments (2  
for 1))

I get the same result with date\_select as well. Any help would be  
appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 9, 2008, 9:22am UTC](https://www.ruby-forum.com/t/rails-2-1-and-ddatetime-select/139923/2 "2008-06-09T09:22:06Z")

</div>

On Jun 9, 5:54 am, Hugh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve updated to 2.1 and am continuing to have issues with  
> datetime\_select helpers which worked fine previously.

Random guess: You’ve got a plugin that overrides certain view helper  
methods

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2008, 7:43pm UTC](https://www.ruby-forum.com/t/rails-2-1-and-ddatetime-select/139923/3 "2008-06-10T19:43:02Z")

</div>

Bingo, I replaced my old 12\_hour plugin with this one:  
[http://code.google.com/p/rails-twelve-hour-time-plugin/](http://code.google.com/p/rails-twelve-hour-time-plugin/) and it all  
works. Thanks.

On Jun 9, 12:21 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 26, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/rails-2-1-and-ddatetime-select/139923/4 "2008-06-26T19:16:48Z")

</div>

Fellas,

I also just updated to 2.1 from 2.0.2, seems I have a similar problem,  
but I don’t have any view helper plugins involved:

ArgumentError in Entries#index wrong number of arguments (3 for 2)

8: = date\_select( ‘context’, ‘start\_date’, {:start\_year =\>  
2007, :order =\> [:month, :day, :year], :use\_short\_month =\>  
true, :include\_blank =\> false})

According to the API, this should still be valid, so I’m guessing the  
error is something else.

I _do_ have an override of a DateHelper method so that my selects can  
actually have unique dom IDs, but I just compared the old and new  
versions of the DateHelper method I’m overriding, and they don’t  
appear to have changed:

Rails 2.1:  
def name\_and\_id\_from\_options(options, type)  
options[:name] = (options[:prefix] || DEFAULT\_PREFIX) +  
(options[:discard\_type] ? ‘’ : “[#{type}]”)  
options[:id] = options[:name].gsub(/([[(])|(][)/,  
‘\_’).gsub(/[])]/, ‘’)  
end

Rails 2.0.2:  
def name\_and\_id\_from\_options(options, type)  
options[:name] = (options[:prefix] || DEFAULT\_PREFIX) +  
(options[:discard\_type] ? ‘’ : “[#{type}]”)  
options[:id] = options[:name].gsub(/([[(])|(][)/,  
‘\_’).gsub(/[])]/, ‘’)  
end

My override in initializers/date\_helper.rb:

module ActionView  
module Helpers  
module DateHelper  
def name\_and\_id\_from\_options(options, type)  
options[:name] = (options[:prefix] || DEFAULT\_PREFIX) +  
(options[:discard\_type] ? ‘’ : “[#{type}]”)  
name = options[:name].gsub(/([[(])|(][)/, '_’).gsub(/[]  
)]/, ‘’)  
unless options[:id].nil?  
options[:id] = name.sub(/_/, “_#{options[:id]}_”)  
else  
options[:id] = name  
end  
end  
end  
end  
end

Any help is gladly appreciated!

Cheers,  
Billy
