In my app, a user has many score_cards and a score_card belongs to a user
user
score_cards
score_card
The question is, whenever I create a new score_card, ie, ScoreCardsController.create gets called, how do I add this newly created score_card to the current_user (I'm using devise, so current_user is a valid User object).
ScoreCardsController.create
current_user
User
current_user.score_cards << score_card
OR
score_card.user = current_user score_card.save
1.4m articles
1.4m replys
5 comments
57.0k users