rails associations

Dear all,

there are two tables ,one is product, one is location, product has many location, and location belongs to product, all the setting in the models i have done, now in the views/show.html.erb, i want to display the product and its locations, usually we use @product.locations to get all the locations, acturally,it finds all the locations based on the id, but now, i have another column which is item_id in both tables and works as foreign key, so now i want to show the locations of the product where product.item_id=location.item_id , how to do this ?


This is apparently related to your earlier post, but the function of item_id appears to have changed. Please clarify what this item_id column is. If it is a foreign key what is it a key to?

If this is actually the same problem as the previous one please say so on one of the threads and say that conversation should be in the other one so that we do not have a conversation split over two threads.