Rquerypad plugin

Plugin details

Simplify query options with association automation and improve inner join for activerecord of rails.

Websitehttp://rquerypad.rubyforge.org/ Repositoryhttp://rquerypad.rubyforge.org/svn/trunk/rquerypad/ Author Leon Li LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://rquerypad.rubyforge.org/svn/trunk/rquerypad/

xample
=======
suppose the asscociations of User Thread Reply is 1:N:N

@users = User.find(:all, :group => ["threads.created_at", "name"])


generate:

[:all, {:group=>"threads.created_at, users.name", :include=>[:threads]}]



@users = User.find(:all, :conditions => ["threads_.replies.title = ?", "rquerypad"])


generate:

[:all, {:inner_joins=>["threads"], :conditions=>["replies.title = ?", "rquerypad"], :include=>[{:threads=>:replies}]}]


#note: the :inner_joints is processed by rquerypad before sending sql to database

@users = User.find(:all, :conditions => ["threads.replies.title = ? and threads.id = ?", "rquerypad", 1])


generate:

[:all, {:conditions=>["replies.title = ? and threads.id = ?", "rquerypad", 1], :include=>[{:threads=>:replies}]}]


#note: single "threads" was removed from includes

Setup
=======
#to set debug model, in rails initialized script

$RQUERYPAD_DEBUG = true



#to support rails 1.2.6, in rails initialized script, such as environment.rb
#default support rails 2.0

$RQUERYPAD_RAILS = "1.2"

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: Guest, about 1 month ago