The Id of the current user from the controller (devise)?

Create a record of gain, want to gain.user_id was equal to the current user. Provided that installed Devise

how to do it? helper "current_user" in the controller doesn't work(

@gain = @task.gains.create(params[:gain])
October 8th 19 at 01:39
1 answer
October 8th 19 at 01:41
params_gains = params[:gain].merge(:user => current_user)
@gain = @task.gains.create(params_gains)
merci! there still had to add the — without this, I was not working! - Penelope.Klein commented on October 8th 19 at 01:44

Find more questions by tags Ruby on Rails