Check SQL from Rails scopes
To see the sql generated by a scope method in Rails 3 use the to_sql method. For example:
Post.current.to_sql
=> "SELECT `posts`.* FROM `posts` WHERE (created_at > '2012-02-22')"
To see the sql generated by a scope method in Rails 3 use the to_sql method. For example:
Post.current.to_sql
=> "SELECT `posts`.* FROM `posts` WHERE (created_at > '2012-02-22')"