Ben Allfree :: Painless Programming

Guaranteed results for iPhone, Rails, PHP, .NET, Flash, and more

Show me this in ActiveRecord

October 10th, 2008 · No Comments

This is an example of a query ActiveRecord can not generate (but I wish it would):


PostSearch.find_by_sql("
	select
		ps.*
	from
		post_search ps join posts p on p.id=ps.id
	where
		post_search.id <> #{self.id} and
		abs(length(body_excerpt)-length(body_excerpt))<#{max_diff}
	order by
		duplicate_post_id desc
	"

Tags:

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment