...

/

Model the Database with Active Record’s DSL

Model the Database with Active Record’s DSL

Learn about modeling the database with the DSL of the active record for our Rails application.

Defining Relationships in Rails Database Models

Because we created Widget with manufacturer:references, Rails was able to automatically set that relationship up for us:

cat app/models/widget.rb
class Widget < ApplicationRecord
  belongs_to :manufacturer
end
...