Given a model like:
class PhoneNumber < ActiveRecord::Base
has_many :personal_phone_numbers
has_many :household_phone_numbers
has_many :organization_phones
has_many :people, :through => :personal_phone_numbers
has_many :households, :through => :household_phone_numbers
has_many :organizations, :through => :organization_phones
end
When viewing a phone number, I'm probably going to be viewing it as a nested resource, so the controller is going to have a params item of one of person_id
, household_id
, or organization_id
I need the view to have a link_to "Return", ...
that returns to the correct resource that we came to the phone number from. How should I do this?