-
Connect to the database using: ActiveRecord::Base.establish_connection
-
Create a table to hold your data
-
Link a class “model” to the database table using: class Example < ActiveRecord::Base - now your class will inherit all ActiveRecord’s built-in ORM methods like .create, .find, .save
-
Use migrations to alter your database in a structured and organized manner
-
Each migration should go in a seperate file and increment the number in the file name
-
Inherit from ActiveRecord’s ActiveRecord::Migration using class Example < ActiveRecord::Migration
-
Use the change method, which is more common for basic migrations
-
Now that you have access to ActiveRecord::Migration, you can create tables using only Ruby - create_table :example
-
Run rake db:migrate