I have inherited a rails application however the tables aren’t using the standard rails foreign keys. My question is, how do I modify foreign keys in the bridge table in Rails.
These are the tables:
Sharedboardonforums{id, board, name, path}
Categories{id, name, cached_slug, category_type}
Sharedboardonforums_categories{id, shared, category}
The Sharedboardonforums_categories is the bridge/pivot table between Sharedboardonforums and Categories. shared is for Sharedboardonforums and category is for Categories.
How do I set the foriegn key for Rails to recognize the shared and category as the keys for Sharedboardonforums and Categories?
Version Rails 2.3.5
I changed the relationship with a combination of
has_manyandbelongs_to. I added:foreign_keyto attributes