3 ms·
ActiveRecord Scopes are actually incredible for this. You can separate pieces of queries and recombine them, use parameters for some, etc. I implemented an ent
by brightball 2y ago
ActiveRecord Scopes are actually incredible for this. You can separate pieces of queries and recombine them, use parameters for some, etc.
I implemented an entire search categorized search with Postgres and ActiveRecord with nothing but Scopes.
Scopes are my primary reason for using Rails these days honestly. It makes it so easy to tap into the DB in a reusable way.
https://guides.rubyonrails.org/active_record_querying.html#scopes https://guides.rubyonrails.org/active_record_querying.html#s...