Ernie Miller

No, I don't work in NYC, DC, or the valley, and I'm cool with that.

RSS Feed

Tag Archives: coding

MetaWhere 0.5.2 – Debug your SQL

0 Comments

I just pushed version 0.5.2 of MetaWhere after some discussion on the Rails core mailing list, adding the debug_sql method. What’s the difference between debug_sql and to_sql, you ask?
Read the rest of this post

Filed under Blog
Jul 9, 2010

Uploadify and Rails 3

20 Comments

If you’re using Uploadify, the nifty jQuery file upload plugin — which we’ll forgive for providing all its examples in PHP (*shudder*) — there’s a good chance you followed the general pattern outlined by John Nunemaker over at RailsTips. His article describes in detail how to get Flash to play nicely with Rails sessions using Rack middleware. Unfortunately, Rails 3 requires a few minor changes to this setup.
Read the rest of this post

Filed under Blog
Jul 9, 2010

Scoping Searches with MetaSearch

0 Comments

Earlier this month, I released new gems of MetaSearch and MetaWhere. These gems were important personal milestones for me, because with the release of Rails 3 beta 4 and Arel 0.4.0, I was finally able to make a gem release of the work I’d been putting in on GitHub the past few months. I gave a few summary release notes, and then all fell silent on this blog. Part of this is because I’ve been busy at the office, working on a new iPhone app for a client of ours. Starting tonight, and in preparation for Rails 3 final, I’m going to cover some of the features in more detail. First up: scoping searches.
Read the rest of this post

Filed under Blog
Jun 30, 2010

ActiveRecord::Relation vs Arel

4 Comments

Since the release of ActiveRecord Query Interface 3.0, I think the line has been pretty blurry for the Rails community about where ActiveRecord ends and Arel begins. I’ve seen folks attribute ActiveRecord::PredicateBuilder to Arel, and I’ve seen folks assume that an ActiveRecord::Relation is an Arel object. Neither is the case. Since MetaSearch and MetaWhere both use combinations of ActiveRecord::Relation and Arel under the hood, and I’ve spent some time putting together patches for both Rails core and Arel, the blurry line between them has become more distinct for me. In this post, I hope to clear up some misunderstandings before Rails 3 is released, and the AR 3.0 query interface becomes the norm.
Read the rest of this post

Filed under Blog
May 11, 2010

Why (fork) Arel?

2 Comments

In a few recent posts, you may have noticed me mention my Arel fork on GitHub. I’ve never really devoted a post to discussing that fork, what’s different about it, and why it exists, so here’s some background.

Read the rest of this post

Filed under Blog
May 3, 2010

Introducing MetaWhere

8 Comments

Recently, I spent some time working on a patch to Rails core to allow ActiveRecord::PredicateBuilder to allow more powerful queries — that is, support for additional Arel predicates beyond Equality and In. If you’re not familiar with PredicateBuilder, that’s where the magic happens when converting the arguments you supply to ActiveRecord::Relation#where or ActiveRecord::Base#find‘s :conditions hash into Arel predicates for a query. Anyway, after a brief discussion with Pratik on #rails-contrib, where he shared a bit of insight into his thoughts on tackling the same problem and encouraged me to create a plugin, I came up with a bit of a hybrid — something that I think scratches this particular itch pretty well for me: MetaWhere. Read on for how it works. [Update: If you're arriving via Ruby5 or the Rails weblog, you might also be interested in the latest MetaWhere updates, why I forked Arel, or the main MetaWhere page. Thanks for visiting!]
Read the rest of this post

Filed under Blog
Apr 15, 2010

Ruby 1.9, BasicObject, and ! (not)

2 Comments

In a recent discussion on the Rails-core mailing list, Joe Smith raised an issue that bothered me while I was working on my fork of Arel: predicate negation (not) has odd left-to-right readability. While only a minor annoyance, it did get me to spend some time tonight investigating a possible solution. This was when I got acquainted with Ruby 1.9′s BasicObject class, and more specifically, BasicObject#!.
Read the rest of this post

Filed under Blog
Apr 10, 2010

The latest on MetaSearch

0 Comments

Version 0.3.0 of MetaSearch is out. Changes since the last time I posted include additional view helpers for gathering array input, the addition of unit tests, and easier attribute and association exclusion that honors excluded attributes through associations.
Read the rest of this post

Filed under Blog
Mar 16, 2010

MetaSearch, Object-based searching for Rails 3

45 Comments

This weekend, I spent some time playing around with Rails 3‘s new Arel-based finder code, and put together a new object-based search gem for use with form_for. I’m calling it MetaSearch, both in reference to this domain, and all the metaprogramming fun in writing it. Here are the basics…
Read the rest of this post

Filed under Blog
Mar 7, 2010

SimpleSearch, searching ActiveRecord Objects with form_for

0 Comments

About 2 years ago, I made a basic how-to post on building a search model that could be used with form_for. I still really enjoy this basic pattern for search forms, but it always seemed like most of the gems I found relating to search were far more involved than I need, providing integration with fulltext search engines, and so on.
Read the rest of this post

Filed under Blog
Feb 24, 2010

About

I'm Ernie Miller. But then, you probably knew that by looking at the page title, or the URL. I'm a Ruby programmer in Louisville, Kentucky. This blog used to be called "metautonomo.us", which I thought was kind of clever, but nobody, including me, could type it. Lesson learned.