Create maintainable queries in Ruby with query object and criterias
Leaving query logic in a single class lead to god objects hard to maintain, I explain a maintainable alternative with query objects and criterias http://teotti.com/create-maintainable-mongodb-queries-in-ruby-with-query-object-and-mongoid-criterias/ The examples use mongodb but can be implemented with Active Record too.
Comments
You also have siphon to dynamically apply scopes on any activeRelation object. It’s small and mostly PORO (no ransack magick although it also works with it).
Post a comment