There are many tutorials that show you how to create the model instructions for a has_many :through relationship in Rails, but there doesn't seem to be many articles related to the process of setting up forms to create and edit these relationships. I am seeking some assistance (or good examples) of how to create an interface that will allow users to manage these types of relationships in a Rails app.
Here's the scenario:
I have Users, Relationships, and Athletes. A User can have a Relationship with an Athlete in a variety of roles: Coach, Mentor, Parent, or Fan.
Here are my models:
class User < ActiveRecord::Base
has_many :relationships
has_many :athletes, :through => :relationships
end
class Athlete < ActiveRecord :: Base
has_many :relationships
has_many :users, :through => :relationships
end
class Relationship < ActiveRecord :: Base
belongs_to :users
belongs_to :athletes
end
So, the next step is to build the views and controllers that allows me to create a User-to-Athlete relationship (with a coach, parent, etc role), edit the relationship, or destroy the relationship.
Ultimately, my aim is to have a scenario where Users can create Athletes and choose the associated Relationship.
Unfortunately, I can't find any specific tutorials or references that gives me much more than the model instructions or the example for a has_many relationship.
If anyone has a link or example that can solve this problem at a simple level, I should be able to customize the rest.