Rails 3.1 and the future of MetaWhere and MetaSearch

Comments

Rails 3.1.0 has dropped, and hours later I received my first “report” that MetaWhere doesn’t work with Rails 3.1. For those of you who read this blog or follow me on Twitter, this should come as no surprise. Still, I wanted to make a quick announcement here, if only to have a place to link people to when they inquire.

MetaWhere -> Squeel

Some time ago, I blogged about a MetaWhere 2.0 rewrite. This rewrite made changes that were extensive enough that I decided to forgo a new version number and jump straight to releasing an entirely new gem, Squeel.

Squeel was written in tandem with the Rails 3.1 beta development process, so it’s ready to go on day one. It’s also been backported to 3.0.x since then, and while doing so has required backporting and monkey-patching certain ARel functionality as well, I’m pretty happy with the results – all specs are green against Rails 3.0.10.

This means that there is a clear migration path ahead for your app, if you’re using MetaWhere. You can migrate your MetaWhere queries to the Squeel DSL, first (I’d encourage you to bypass the Symbol extensions, if you can), then migrate to Rails 3.1 once all your specs are passing.

Why the break with the old? Read the original rewrite announcement for the details. In short, I made some bad architectural decisions in MetaWhere. While a lot of people really liked the gem, under the hood, things were a mess. I could have hobbled along with the existing codebase for a while longer, but it was becoming increasingly painful to do so. Besides, I’d had some new ideas about the way I’d approach a query DSL. Squeel is what came of those new ideas.

MetaSearch -> Ransack (eventually)

MetaSearch is a bit of a different animal. First, its hooks into the ActiveRecord internals are much more shallow than MetaWhere’s, so it was simpler to port over to 3.1. Second, while Squeel is mostly a superset of MetaWhere, in terms of functionality, Ransack provides fundamentally different types of search functionality, and hasn’t been completely bulletproofed. I’m using it in a few projects, myself, but for those who are looking to do a drop-in replacement for MetaSearch, it’s not quite there, yet.

As such, I’ve released a v1.1.0 of MetaSearch, which works with Rails 3.1. I’d still encourage those of you who are starting a new greenfield application on 3.1 to start with Ransack, as this is the long-term path forward.

Many of the same decoupling steps taken in the MetaWhere -> Squeel transition were also taken with Ransack, so it should provide a solid foundation to build on, going forward.

Conclusion

Thanks again for using my gems! The steady stream of appreciation and kind words have made working on them a real pleasure (on most days!). Still, I’m only one guy, and I have clients to serve, and a family I need to love and spend time with. As such, I just can’t justify spending tons of time maintaining MetaSearch and MetaWhere in addition to their replacements.

I hope you’ll understand, and I hope that you will give Squeel and Ransack a try!

comments powered by Disqus