github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

radar / sql_display

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 9
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Display the SQL of any given query — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Fixed up docs, added example for scopes. 
radar (author)
Fri Sep 11 18:20:50 -0700 2009
commit  d7dcbbe8c6165df156a144d4ab5e348dcfdd1dd2
tree    45bbf8b7d1375d939f766cf3f053d2b8744ea4d5
parent  63fd4f171311e23c795abc9c737e61736f563afd
sql_display /
name age
history
message
file .gitignore Wed Jun 10 04:35:18 -0700 2009 This is a plugin that wiill give you the output... [radar]
file MIT-LICENSE Wed Jun 10 04:35:18 -0700 2009 This is a plugin that wiill give you the output... [radar]
file README.markdown Fri Sep 11 18:20:50 -0700 2009 Fixed up docs, added example for scopes. [radar]
file Rakefile Fri Sep 11 18:15:53 -0700 2009 Remove icky code and replace with awesome const... [radar]
directory config/ Sun Jun 14 01:36:42 -0700 2009 Rewrite of the plugin. Better way to gather the... [radar]
file init.rb Sun Jun 14 01:36:42 -0700 2009 Rewrite of the plugin. Better way to gather the... [radar]
directory lib/ Fri Sep 11 18:15:53 -0700 2009 Remove icky code and replace with awesome const... [radar]
directory log/ Thu Jun 11 01:00:59 -0700 2009 Write test to ensure hat it reverts the logger [radar]
directory rails/ Fri Sep 11 18:15:53 -0700 2009 Remove icky code and replace with awesome const... [radar]
directory spec/ Fri Sep 11 18:20:50 -0700 2009 Fixed up docs, added example for scopes. [radar]
file uninstall.rb Wed Jun 10 04:35:18 -0700 2009 This is a plugin that wiill give you the output... [radar]
README.markdown

sql_display

For when you want to display the SQL a query executes, but don't want to go into the log!

Usage Examples

sql takes the same options as find and will only show you the first query it runs. count_sql takes the same options as count, same deal.

>> Post.sql
=> "SELECT * FROM \"posts\""

>> Post.sql(:order => "id DESC")
=> "SELECT * FROM \"posts\" ORDER id DESC"

>> Post.scoped({}).sql
=> "SELECT * FROM \"posts\""

>> Post.count_sql
=> "SELECT count(*) AS count_all FROM \"posts\""

>> Post.count_sql(:text)
=> "SELECT count(\"posts\".text) AS count_text FROM \"posts\""

Contributors

perplect

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server