[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Newbie help with scaffold generator

Paul Johnston

8/21/2006 9:28:00 AM

Hi
I'm new to rails and ruby and am working through Agile Web Development
with Rails Edition 1 and have a question if someone could point me in
the right direction.
I have my table which has a datetime field
I generate a scaffold and in the new.rhtml page I get drop down lists
enabling me to choose a date.
If I wished to modify the range of available dates i.e. the years
where does scaffold look to choose this data ?
TIA Paul
2 Answers

Ashutosh

8/21/2006 10:04:00 AM

0

Paul Johnston wrote:
> Hi
> I'm new to rails and ruby and am working through Agile Web Development
> with Rails Edition 1 and have a question if someone could point me in
> the right direction.
> I have my table which has a datetime field
> I generate a scaffold and in the new.rhtml page I get drop down lists
> enabling me to choose a date.
> If I wished to modify the range of available dates i.e. the years
> where does scaffold look to choose this data ?
> TIA Paul

Hi,

I think Rails picks it from
\ruby\lib\ruby\gems\1.8\gems\rails-1.1.6\lib\rails_generator\generators\components\scaffold.

Alternatively, you may write your own code (and not use scoffold) to
get required range of dates (years etc) using datetime helpers.

As an example, add following code in your rhtml where you need the date
field:

date_select("post", "written_on", :start_year => 1995,
:use_month_numbers => true,
:discard_day => true, :include_blank => true)

Check out details and other date time helpers at
http://railsmanual.com/module/ActionView::Helpers::...

HTH,
Ashutosh

Paul Johnston

8/21/2006 10:52:00 AM

0

On 21 Aug 2006 03:03:35 -0700, "Ashutosh" <ashutosh.ambekar@gmail.com>
wrote:

>Paul Johnston wrote:
>> Hi
>> I'm new to rails and ruby and am working through Agile Web Development
>> with Rails Edition 1 and have a question if someone could point me in
>> the right direction.
>> I have my table which has a datetime field
>> I generate a scaffold and in the new.rhtml page I get drop down lists
>> enabling me to choose a date.
>> If I wished to modify the range of available dates i.e. the years
>> where does scaffold look to choose this data ?
>> TIA Paul
>
>Hi,
>
>I think Rails picks it from
>\ruby\lib\ruby\gems\1.8\gems\rails-1.1.6\lib\rails_generator\generators\components\scaffold.
>
>Alternatively, you may write your own code (and not use scoffold) to
>get required range of dates (years etc) using datetime helpers.
>
>As an example, add following code in your rhtml where you need the date
>field:
>
>date_select("post", "written_on", :start_year => 1995,
>:use_month_numbers => true,
>:discard_day => true, :include_blank => true)
>
>Check out details and other date time helpers at
>http://railsmanual.com/module/ActionView::Helpers::...
>
>HTH,
>Ashutosh

Hugh help,
Many Thanks Paul