rails : User button to join / leave a team
===

Currently, I get two tables :
Users (with a foreign_key : team_id) 
Teams

And I try to make a button on the team page (e.g. myapp/teams/1 ) where a user (who call current_user) can join or leave this team.

To join a team we juste have to update the column user.team_id and put on this the id of  the team (to leave a team, the column user.team_id need to be empty).


Anyone have an idea to make these two buttons ? :)

Thank ! 