Ruby on Rails generates model field:type - what are the options for field:type?
generator, rails-activerecord, ruby-on-rails
Solution
:primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp,
:time, :date, :binary, :boolean, :references
See the table definitions section.
Problem
I'm trying to generate a new model and forget the syntax for referencing another model's ID. I'd look it up myself, but I haven't figured out, among all my Ruby on Rails documentation links, how to find the definitive source. `$ rails g model Item name:string description:text` (and here either `reference:product` or `references:product`). But the better question is where or how can I look for this kind of silliness easily in the future? Note: I've learned the hard way that if I mistype one of these options and run my migration then Ruby on Rails will totally screw up my database... and `rake db:rollback` is powerless against such screwups. I'm sure I'm just not understanding something, but until I do... the "detailed" information returned by `rails g model` still leaves me scratching...