On Apr 2, 7:05 pm, Marcelo de Moraes Serpa <[email protected]>
wrote:

> What I would like to happen is, when a supplier is retrieved using the
> following command:
>
> @suppliers = @product.suppliers.all
>
> Somehow hook up AR and look into the type attribute of the
> products_suppliers association and for each record, instantiate the correct
> class (either Vendor or Manufacturer).
>

So for any given row in product_suppliers,  there's a supplier_id.
Surely the row in the suppliers table with that id is either a
Manufacturor or a Vendor ?

Fred



> It's STI, only that the type data is in another realm and is "variable"
> (depending on the product).
>
> Is there a way to do that with the current STI implementation in Rails
> 2.2.2? If not, how could I hook up AR to make it happen? Or do you suggest
> something simpler?
>
> Any suggestions appreciated.
>
> Marcelo.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to