Date_select

Hi all
I am using rails 2.3.5. But I am facing the problem with date_select
tag. I have written code as follow.

= date_select :post, :birthdate, :start_year => 1950, :end_year =>
Date.today.year, :prompt => { :day => ‘Select day’, :month => ‘Select
month’, :year => ‘Select year’ }

But I got error like “wrong number of arguments (2 for 1)”. If I write
only
= date_select :post, :birthdate
than also I got the same error.

I have tried like
date_select :post
than it gives me error like “wrong number of arguments (1 for 2)”.

Help me out…

On Fri, 2010-01-29 at 05:53 +0100, Smit S. wrote:

= date_select :post, :birthdate
than also I got the same error.

I have tried like
date_select :post
than it gives me error like “wrong number of arguments (1 for 2)”.

Help me out…


date_select(object_name, method, options = {}, html_options = {})

I don’t think you are going to have any success without the parens

Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Without knowing more about your app and your models, I would ask what
the :post refers to in your date_select.

If I understand you correctly, you want to render a date select field
for the ‘birthdate’ attribute. What model does this attribute belong
to? Are you using the date_select as part of a form? If so could you
post that entire form?

Without further info, I’d say get rid of the ‘:post’ in the
date_select. And go from there.

-Alexis M.

Alexis Mueller wrote:

Without knowing more about your app and your models, I would ask what
the :post refers to in your date_select.

If I understand you correctly, you want to render a date select field
for the ‘birthdate’ attribute. What model does this attribute belong
to? Are you using the date_select as part of a form? If so could you
post that entire form?

Without further info, I’d say get rid of the ‘:post’ in the
date_select. And go from there.

-Alexis M.

Thanks for your reply…

:post is my object and the :birthdate is my field in table. With the
help of :post I am able to generate field name like post[birthdate]. I
cant remove that because I am using multi model in a single form.