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
2.1m questions
2.1m answers
60 comments
57.0k users