So I have 3 fields in my HTML, lunchMonth, lunchDay and lunchYear
lunchMonth and lunchDay are Select tags with option tags for months and days remaining in the year. lunchYear is set to 2011.
I've set up a form but I need to generate a scaffold to take these 3 values.
What's the proper way to do this?
Rails generate scaffold Date month:string date:integer year:integer
Is that right?
You don't need to use select tags or write out your HTML with
scaffold
rails will do that for you. dorails generate scaffold LunchTimes lunch_on:date
(NOTE: rails has adate
data type.)and rails will generate views in
app/views/lunch_times/*
that use theselect_date
helper to generate the needed HTML.it will also generate a model in
app/models/lunch_time.rb
and a controller:app/controllers/lunch_times_constrollers.rb
EDIT:
I'd encourage you to checkout the Rails Guides here: http://guides.rubyonrails.org/index.html
http://api.rubyonrails.org is also a good reference.
I've found them very helpful.