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.

On Sat, Jul 5, 2008 at 8:48 AM, gianpero [email protected] wrote:

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 -%>

  1. 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

Rails, RSpec and Life blog…

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.

On Mon, Jul 7, 2008 at 3:02 AM, gianpero [email protected] wrote:

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

Rails, RSpec and Life blog…

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.