Answer the question
In order to leave comments, you need to log in
Id of the current user from the controller (devise)?
I create a gain entry, I want gain.user_id to be equal to the current user. Provided that Devise installed
how to do it? "current_user" helper in controller doesn't work(
@gain = @task.gains.create(params[:gain])
Answer the question
In order to leave comments, you need to log in
params_gains = params[:gain].merge(:user => current_user)
@gain = @task.gains.create(params_gains)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question