#Activerecord
6 notas · última:
Spectacles
Spectacles adds database view support to ActiveRecord, with migrations, an abstract view class, and support for several database drivers. It also offers PostgreSQL materialized views with refresh and creation options.
Remove N+1 queries in your Ruby on Rails app
Explains the N+1 query problem in Rails and shows how eager loading, grouping, SQL joins, and the Bullet gem reduce repeated database calls in common cases.
What are some of the things about Ruby on Rails that most developers don't know?
The page points out two Rails details: ActiveRecord::Relation#to_sql exposes the SQL behind a query, and association conditions can reuse a model's own where_values_hash instead of hard-coding schema details.
Why ActiveRecord Sucks - Very Good Indicators
The post says ActiveRecord is useful, but its convenience comes with memory overhead, tighter coupling, weaker SQL for complex queries, and less readable code when queries get intricate.
Reading Rails - The Adapter Pattern
The article surveys how Rails uses the Adapter Pattern to hide differences between JSON libraries, databases, and time classes, keeping a uniform API while still handling library-specific details.
Getting to Know Pluck and Select
The post compares `pluck` and `select` in ActiveRecord, showing that `pluck` avoids model instantiation overhead, is faster for raw values, and `select` still matters when you need model objects and methods.
