I've managed to get my system working - a tweak to solution 3. If rather than using Hobo's built in filtering in the controller, I create named-scopes for anything I want to filter, I can specify the column name without table name, and am able to get what I need.
Thanks again! Steve. On Jul 15, 3:40 pm, Steve VB <[email protected]> wrote: > I'm running into trouble with joins in table plus. I've tried > different methods that all run into issues or bugs. > > Solution 1: named_scope with :include to use all the magic of > ActiveRecord. There's a bug with the Limited Eager Loading > functionality. It seems to load a list of 30 record id's without > trouble (if I paste the query into my interactive SQL tool, I get a > list of ID's). But the query it generates to fetch the data has > WHERE ID IN (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) > with the result that nothing is returned. Not helpful. > > Solution 2: named_scope with :joins. Queries work fine. It joins > with the table I want. Unfortunately the final select only selects > the fields from the main table. > > Solution 2b: named_scope with :joins and :select to specify the > columns I want. One of the queries that's generated to produce the > result (may be will_paginate or table-plus -- don't know) does a count > (:select) where :select is what ever I stick there. The default of * > works fine, but a list of fields does not. > > Solution 3: named_scope with :from pointing at a database view made of > my main table joined to the one I want to pull data from. Select > works great, and allows me to display the data in the table. When I > try to filter it though, the SQL code generator wants to add the table > name to the field name for the condition ([TABLE].Field = "Filter") > but the [TABLE].Field is not found in the view and I get an error. > > Does anyone know how to work around any of these issues, or some other > way to get a join to work with <table-plus>? > > Thanks! > > Steve. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
