Skip to content
Tags

,

.to_sql

April 11, 2011

Use method .to_sql to see how Active Record Queries get converted to SQL quries.

Example:

ruby-1.9.2-p136 :223 > Product.where(:id => 43).to_sql
 => "SELECT `products`.* FROM `products` WHERE `products`.`id` = 43"
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: