HMT Help

Matt White
2007-12-06T19:50:37Z

Hello,

I''ve been asked to create an admin tool for an existing project. There
are 2 tables that I need to work with all the time in this tool:
displays and categories. These two tables have a many to many
relationship, so I''ve added a third table, category_displays.
I''d like
to be able to use the has_many :through method to make this a lot
easier to work with, however, the way the existing parts of this
project are defined is making it difficult to do so.

Basically, categories are all divided up by suppliers, so there
actually is no categories model (categories is a table that includes a
field called supplierid). Instead, those that came before me defined a
categories *module* that, when a get_instance method on it is called,
returns a specific supplier class, which sets its table name to
categories and is able to access the categories table. This makes it
impossible to say (in the display model):

has_many :category_displays
has_many :categories, :through => :category_displays

This is, once again, because there is no categories model, just a
categories module. I know this is kind of a quirky design but I have
to deal with it and try to change it as little as possible. Is there
an easy way to get the has_many :through association to work in this
situation? Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---