Datetime_select problem

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

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

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

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs