You might want to look at ferret or solr.  With those, you can build
your index on any method so you could look have a field that looks up
what joined model is.  The extra cost is on update/create only and
reads are very fast.  solr might be the better choice if you will need
to be able to scale your app now or in the future.

On Dec 28 2009, 12:35 am, andrew hill <[email protected]> wrote:
> On Dec 27, 2009, at 6:27 PM, Matt Jones wrote:
>
>
>
>
>
> > On Dec 23, 2009, at 1:29 PM, andrew hill wrote:
>
> >> hi folks,
>
> >> i'm trying to figure out how to display different data on the show  
> >> record page than the table display / search page.
> >> e.g. i've got a model called "guitar" that produces an output like  
> >> this when i list / search on it:
> > [snip]
> >> those two or three-letter codes are "factory" codes in my guitar  
> >> database table, and i'd like to leave them be, so people can search  
> >> using a combo of standard codes.
>
> >> i've got another table/model called "factorycodes" which only has 2  
> >> columns, one with the 3-letter code, and the other with a plain  
> >> english translation (e.g. WHT is White)
>
> >> when i click on the guitar serial number under the "Guitar" column,  
> >> though, i'd like to do some sort of join so that the individual  
> >> record listing replaces the column values with ones from the other  
> >> table, e.g. modify this below:
>
> > [snip]
> >> anyone have a suggestion how to do this?  i've been trying various  
> >> "through" syntax but not 100% sure what i'm doing, as i can only  
> >> seem to break the lookups :)
>
> > There are some fancy options for associations like :primary_key that  
> > *might* be able to help here, but the support is lacking in Rails at  
> > the moment (still some latent bugs with preloading and has_one).
>
> > But I'm thinking you might be better off using a rich-type sort of  
> > thing to handle this; it would also help when it comes time to input  
> > data, as the dropdowns could show English options rather than codes.  
> > Not sure exactly how it would work, since the standard enum_string  
> > stuff only works with options known at compile time. Maybe take a look  
> > at how the Agility tutorial handles DB-powered story status?
>
> > Hope this helps!
>
> > --Matt Jones
>
> thanks Matt,
>
> I'll give it a go - you are probably right; giving the user english-language 
> dropdowns up front with options instead makes sense.  
>
> thanks,
> andrew
-- 
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.


Reply via email to