Model in Ruby on Rails

Lets see how to create a model on Ruby on Rails

I want to create Product and Category models. Product model has a reference to Category model

So I first create the model Category

Your migrated file @db\migrate location

and then run the migrate

Second I will create the Product

You can see the migrated file

and then run the migrate

/usr/local/Cellar/ruby/2.6.5/bin/ruby /Users/Niro/RubymineProjects/untitled/bin/rails g model product product_name sku album:references

/usr/local/Cellar/ruby/2.6.5/bin/ruby /Users/Niro/RubymineProjects/untitled/bin/rails

Rails model generator saves time

List of available types
integer
primary_key
decimal
float
boolean
binary
string
text
date
time
datetime
timestamp