RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in