I have two models, Player and Event. A player can subscribe to several
events and a event has several participants (players). Therefore, it
is a many-to-many relationship. My question now is how do I have to
implement this many-to-many relationship using the REST approach.
I do not need to store additional information in the bridge table
(let’s call it “subscriptions” or “events_players”), therefore I added
“has_and_belongs_to_many” to the player and the events model. What I
am now missing is a “subscribe” action, that I would normally stick
into the player controller, but this violates the REST pattern,
because it is not a CRUD action.
The only way around this, that I see, is to make subscription a full
blown model with its own RESTful controller. This would give me CRUD
operations on “subscriptions”, with new/create being the equivalent to
a subscribe action, correct?
Is it therefore correct to say, that “has_and_belongs_to_many” cannot
be used in RESTful applications?
What are your thoughts on this?