没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > rquerypad |
rquerypad
|
0 | 0 | 41 |
贡献者 | 讨论 | 代码提交 |
Version0.1.13
Featuresingle name string decribe associations support to mix inner join and outer join with any order auto remove duplicated joins from other association in different depth support :conditions, :order, :group auto merge to original :include, :joins support rails 2.0 and rails 1.2 with finder in 2.0 way Installruby script/plugin install http://rquerypad.googlecode.com/svn/trunk/rquerypad
Examplesuppose 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 includesSetup#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"
TestNote: current migrate script works only in rails 2.0
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