From: Paul Johnston Date: 2006-08-21T19:55:10+09:00 Subject: Re: Newbie help with scaffold generator On 21 Aug 2006 03:03:35 -0700, "Ashutosh" 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::DateHelper > >HTH, >Ashutosh Hugh help, Many Thanks Paul