- string
- text (long text, up to 64k, often used for text areas)
- datetime
- date
- integer
- binary
- boolean
- float
- decimal (for financial data)
- time
- timestamp
Here is an example of using rails 3.x scaffolding with data types, run from the Rails application root directory:
ruby script/rails generate scaffold Modelname name:string title:string employed_on:date remarks:text
ruby script/rails generate scaffold Modelname name:string title:string employed_on:date remarks:text
ReplyDeleteit is rails2
VeGeek,
ReplyDeleteIt still works in rail 3.0. I've used it recently with rails 3.0.3.
Keith
Awesome! This is exactly what I was looking for.
ReplyDelete1. Where do you find a comprehensive list for Rails 3?
I tried running "rails g scaffold" but it still doesn't list all the types.
2. Can scaffold generate a file upload field? I've tried :file, but it doesn't work. What would I use for that?
Benxamin,
ReplyDeleteI'm not sure where to find a comprehensive list of all scaffold types, but I don't think there is one for a file upload field. There is a rails form helper for file upload documented here:
http://guides.rubyonrails.org/form_helpers.html#uploading-files