It's a people table (with various pieces of info about them), joined to an address table. I'm trying to do a join between a person and their primary address, and then show data about that person, including some of the address data. So far, I'm just trying to filter/sort on data from the main (people) table.
Database is MS SQL 2005, and I'm talking to it VIA ODBC/FreeTDS from a mac. Thanks again! Steve. -- Steve Van Bruwaene International Teams Canada Special Projects [email protected] http://www.vanbruwaene.ca "Developing Resources that help IT Canada be More Effective in its Mission." IT Canada: 519-669-8844, 1 Union St., Elmira, ON, N3B 3J9 IT US: 847-429-0900, 411 West River Road, Elgin, IL 60123, USA On Wed, Jul 15, 2009 at 5:33 PM, kevinpfromnm <[email protected]>wrote: > > Table plus pretty much works with a collection that is either > identical or responds to the same methods. Search/filter/sort can be > a little tricky but that's all on your db call side. Seems like more > of an issue with your db call. Any more detail on the model(s) > involved and what fields you're trying to display/sort using? > > On Jul 15, 1: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 -~----------~----~----~----~------~----~------~--~---
