select_datetime // datetime_select

Hi I have 2 question for you guys,

1. Which is the difference between this two methods? (select_datetime, datetime_select) 2. How I assign the selected date-time values, to an specific variable or array using select_datetime     I know do it using datetime_select('object','method')

I aprecciate your attention.

Thanks

PD: Sorry about my english.

Hi I have 2 question for you guys, 1. Which is the difference between this two methods? (select_datetime, datetime_select)

One you use along with the form_for type form helpers.

<% form_for @post do |f| -%>   <%= f.datetime_select :post_date -%> <%- end -%>

The other you use if you just want a datetime picker in a form

<form.......>   <%= select_datetime Time.now -%> </form>

2. How I assign the selected date-time values, to an specific variable or array using select_datetime    I know do it using datetime_select('object','method')

<%= select_datetime Time.now -%> <%= f.datetime_select :post_date, :default => Time.now -%>

Regards

Mikel

Hi Mikel,

thanks for your response, But, I still don't understand how asign the value using select_datetime,

For example, If I have <=%datetime_select 'reservation','start_at'%> How I do the same, using select_datetime.

Another additional question, I am developing an application in spanish, so I need the months in spanish. There is some option that allow me do it, or I have to modified the date_helper and copy the method as a application_helper??

thanks again.

thanks for your response, But, I still don't understand how asign the value using select_datetime,

For example, If I have <=%datetime_select 'reservation','start_at'%> How I do the same, using select_datetime.

You need to assign a name to it per the HTML standards for form elements.

If you look at the RDoc for ActionView::Helpers::DateHelper it will give you what you need. Especially the first paragraph about the :prefix option.

Another additional question, I am developing an application in spanish, so I need the months in spanish. There is some option that allow me do it, or I have to modified the date_helper and copy the method as a application_helper??

Go have a look at the globalize plugin. Very cool. I use it for multi language apps.

http://www.artweb-design.de/2006/11/10/get-on-rails-with-globalize-comprehensive-writeup

Hi, thanks again for your answers.

I try the globalize plugin, but it doesn't work with my application, i think the problem is that I use RoR 2.1. Finally I use Globalite, a similar plugin very cool ans easy too. Maybe you want to get a view.

Thanks again.