Posted By: Leon Li
Date: 2008-03-19 21:10
Summary: Rquerypad, 0.1.0 released
Project: Rquerypad

Rquerypad, release 0.1.0 (Mar. 2008)
=========
Simplify query options with association automation and improve inner join for activerecord of rails

Feature
=======
1. single name string decribe associations
2. support to mix inner join and outer join with any order
3. auto remove duplicated joins from other association in different depth
4. support :conditions, :order, :group
5. auto merge to original :include, :joins

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

Example
=======
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

Usage
=======
put the following code in you initializer

#if you want to print log, use Rquerypad.prepare_with_debug
Rquerypad.prepare


Test
=======

1.Prepare

the test depends on sqlite3 database, the following code should be add into your database.yml and place rquerypad.rb(copy from test.rb) in config/environment

rquerypad:
adapter: sqlite3
database: vendor/plugins/rquerypad/test/db.rquerypad
timeout: 5000

2.database migrate

execute the following script

rake migrate

3.start test

execute the following script
rake


Copyright (c) 2008 Leon Li, released under the MIT license

Latest News
icalendar 1.4.0 Released
    Ryan Ahearn - 2013-05-21 23:17
BinData 1.5.0 - source moved to github
    Dion Mendel - 2013-05-21 11:10
v13.5.0 Released !!
    id 774 - 2013-05-18 12:28
Runt v0.9.0 Released
    Matthew Lipper - 2013-05-17 00:11
kramdown 1.0.2 released
    Thomas Leitner - 2013-05-09 06:58

 

Forums | Admin

Discussion Forums: rquerypad--release-0.1.0

Start New Thread Start New Thread

 

Topic Topic Starter Replies Last Post