🧙 Part 4 — ActiveRecord Magic: Rails’ Powerful ORM
ActiveRecord lets you interact with the database using plain Ruby.
Example migration:
create_table :posts do |t| t.string :title t.text :content t.timestamps end
And in your model:
class Post < ApplicationRecord validates :title, presence: true end
Now, interact easily:
Post.create(title: "Hello Rails!", content: "First post.") Post.all Post.find(1)
Top comments (0)