# Datetime\_select problem

**URL:** <https://www.ruby-forum.com/t/datetime-select-problem/81182>\
**Category:** Rails\
**Created:** [January 6, 2007, 12:04am UTC](https://www.ruby-forum.com/t/datetime-select-problem/81182 "2007-01-06T00:04:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tschendel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tschendel](https://www.ruby-forum.com/u/tschendel)\
**Post date:** [January 6, 2007, 12:04am UTC](https://www.ruby-forum.com/t/datetime-select-problem/81182/1 "2007-01-06T00:04:59Z")

</div>

I have a problem with the datetime\_select helper.  
In my view i use these both statements:

\<%= datetime\_select :absent :last\_date %\>  
\<%= date\_select :absent :last\_date %\>

in my db last\_date is declared as type ‘datetime’

The date\_select helper works fine, but the datetime\_select helper  
generates a

private method ‘hour’ called for #\<Date: 49…\> message

in date\_helper.rb :150 in ‘select\_hour’

Thanks for help

---

<div class="post-metadata">

**Author:** ![tschendel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tschendel](https://www.ruby-forum.com/u/tschendel)\
**Post date:** [January 6, 2007, 1:33am UTC](https://www.ruby-forum.com/t/datetime-select-problem/81182/2 "2007-01-06T01:33:54Z")

</div>

Otmar Tschendel wrote:

> I have a problem with the datetime\_select helper.  
> In my view i use these both statements:
> 
> \<%= datetime\_select :absent :last\_date %\>  
> \<%= date\_select :absent :last\_date %\>
> 
> in my db last\_date is declared as type ‘datetime’
> 
> The date\_select helper works fine, but the datetime\_select helper  
> generates a
> 
> private method ‘hour’ called for #\<Date: 49…\> message
> 
> in date\_helper.rb :150 in ‘select\_hour’
> 
> Thanks for help

What are you unhappy about; why can’t you use the version that works?  
What are you trying to do?

Stephan

---

<div class="post-metadata">

**Author:** ![tschendel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tschendel](https://www.ruby-forum.com/u/tschendel)\
**Post date:** [January 6, 2007, 6:55pm UTC](https://www.ruby-forum.com/t/datetime-select-problem/81182/3 "2007-01-06T18:55:44Z")

</div>

Otmar Tschendel wrote:

> The date\_select only shows the date. The datetime\_select normaly gives  
> you date and time - and thats what i need. I tested both, because both  
> use the same parameter - so i think there is a error in rails.

You mean you think that datetime\_select doesn’t do what it was designed  
to do?

Why does the error message say \<#Date… if you say the column is  
datetime ?

What do you get when you execute, in “script/console”,

ModelName.columns.find { |a| a.name==‘last\_date’ }

(I don’t know the model name in question here)

Stephan

---

<div class="post-metadata">

**Author:** ![tschendel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tschendel](https://www.ruby-forum.com/u/tschendel)\
**Post date:** [January 6, 2007, 11:08am UTC](https://www.ruby-forum.com/t/datetime-select-problem/81182/4 "2007-01-06T11:08:33Z")

</div>

Stephan W. wrote:

> Otmar Tschendel wrote:
> 
> > I have a problem with the datetime\_select helper.  
> > In my view i use these both statements:
> > 
> > \<%= datetime\_select :absent :last\_date %\>  
> > \<%= date\_select :absent :last\_date %\>
> > 
> > in my db last\_date is declared as type ‘datetime’
> > 
> > The date\_select helper works fine, but the datetime\_select helper  
> > generates a
> > 
> > private method ‘hour’ called for #\<Date: 49…\> message
> > 
> > in date\_helper.rb :150 in ‘select\_hour’
> > 
> > Thanks for help
> 
> What are you unhappy about; why can’t you use the version that works?  
> What are you trying to do?
> 
> Stephan

The date\_select only shows the date. The datetime\_select normaly gives  
you date and time - and thats what i need. I tested both, because both  
use the same parameter - so i think there is a error in rails.

---

<div class="post-metadata">

**Author:** ![tschendel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tschendel](https://www.ruby-forum.com/u/tschendel)\
**Post date:** [January 6, 2007, 9:42pm UTC](https://www.ruby-forum.com/t/datetime-select-problem/81182/5 "2007-01-06T21:42:12Z")

</div>

Stephan W. wrote:

> Otmar Tschendel wrote:
> 
> > The date\_select only shows the date. The datetime\_select normaly gives  
> > you date and time - and thats what i need. I tested both, because both  
> > use the same parameter - so i think there is a error in rails.
> 
> You mean you think that datetime\_select doesn’t do what it was designed  
> to do?
> 
> Why does the error message say \<#Date… if you say the column is  
> datetime ?
> 
> What do you get when you execute, in “script/console”,
> 
> ModelName.columns.find { |a| a.name==‘last\_date’ }
> 
> (I don’t know the model name in question here)
> 
> Stephan

Many thanks for your direction. It was not rails, it was was my fault. I  
used the wrong column in my db.

Otmar
