Rails 3
User.active.to_sql
Rails 2
Use either the 
  Edge Rider
  
    Show archive.org snapshot
  
 or 
  fake_arel
  
    Show archive.org snapshot
  
 gem to get #to_sql backported to Rails 2.
If you don't want to use a gem for this, you can do this with vanilla Rails 2:
User.active.construct_finder_sql({})
Posted by Henning Koch to makandra dev (2011-04-07 16:09)