How to create model in Rails?
Rails uses rake command line tool for creation of models. The following example does just that
> rails generate model Product title:string description:text
This command line will generate migration file with the following Rails code
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :title, :null => false
t.string :description
t.timestamps null: false
end
end
You can provision this model to your RDBMs via the following Rake command line
> rake db:migrate