I've got a patch to fix nested joins like User.select { |it|
it.group.venue.name == 'Boston' }. Currently this builds a hash like
{:conditions=>"groups.`name` = 'Boston'", :include=>[:group]}, the
same as if you'd said
it.group.name instead of
it.groups.venue.name.
It ought to make something like {:conditions=>"venues.`name` =
'Boston'", :include=>{:group=>:venue}}.
I was thinking of contributing this to the project, if this hasn't
already been done, and if there's interest. It requires some new
specs, and some changes to the existing specs. (It makes currently
changes the :includes from arrays like [:account] to hashes like
{:account => {}}. I could fix this with extra code if it were
necessary, but I don't think it is.)
I haven't even been able to get the existing specs to run, though. Is
this an operator error? -- does the repo version work?
"rake test:adapters:activerecord" gets 13 errors. The first four of
them start like this:
1) Error:
test_spec {ActiveRecord Adapter Count} 001 [size](ActiveRecord Adapter
Count):
SystemStackError: stack level too deep
./adapters/ambitious_activerecord/test/../../../lib/ambition/
api.rb:28:in `size'
./adapters/ambitious_activerecord/test/../../../lib/ambition/
api.rb:28:in `size'
./adapters/ambitious_activerecord/test/count_test.rb:12:in
`test_spec {ActiveRecord Adapter Count} 001 [size]'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run'
and then there's five along these lines:
7) Error:
test_spec {ActiveRecord Adapter PostgreSQL specific} 001 [quoting of
column name](ActiveRecord Adapter PostgreSQL specific):
ArgumentError: wrong number of arguments (2 for 0)
./adapters/ambitious_activerecord/test/select_test.rb:183:in
`initialize'
./adapters/ambitious_activerecord/test/select_test.rb:183:in `new'
./adapters/ambitious_activerecord/test/select_test.rb:183
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:18:in `run'
and four like this:
12) Error:
test_spec {ActiveRecord Adapter MySQL specific} 001 [quoting of column
name](ActiveRecord Adapter MySQL specific):
ArgumentError: wrong number of arguments (4 for 0)
./adapters/ambitious_activerecord/test/helper.rb:29:in
`initialize'
./adapters/ambitious_activerecord/test/helper.rb:29:in
`initialize'
./adapters/ambitious_activerecord/test/select_test.rb:219:in `new'
./adapters/ambitious_activerecord/test/select_test.rb:219
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:18:in `run'