xpepermint
xpepermint

Reputation: 36243

Rails activerecord to_sql_string?

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

Client.find(1).to_sql_string

Upvotes: 1

Views: 383

Answers (2)

fl00r
fl00r

Reputation: 83680

In Rails 3 you can use to_sql method

Client.first.to_sql
#=> some raw sql

Upvotes: 3

user100766
user100766

Reputation:

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

Upvotes: 1

Related Questions