💎 Ruby on Rails
Beginner
What is ActiveRecord in Rails?
Answer
ActiveRecord is the ORM (Object-Relational Mapping) layer in Rails. It implements the Active Record pattern — each database table is mapped to a Ruby class, and each row becomes an instance of that class. ActiveRecord handles CRUD operations, associations, validations, callbacks, and database migrations without writing raw SQL. For example: User.find(1), User.where(active: true), user.save. It supports multiple databases (MySQL, PostgreSQL, SQLite) and abstracts away database-specific SQL differences.