views:

52

answers:

2

I've seen somewhere but can not remember. How to get a SQL string from an ActiveRecord object?

Client.find(1).to_sql_string
+1  A: 

I think you where looking at arel, which has a nice to_sql

jhwist
+2  A: 

In Rails 3 you can use to_sql method

Client.first.to_sql
#=> some raw sql
fl00r