3
I need to create an object from only one button.
I pass nothing to the method, I call only through the button.
All the data I need I have access to the controller action I’m using.
But I can not enter in the database, on account of Strong Parameters.
I’ve tried so many solutions I don’t even know what I’m doing anymore. :/
Here I try to create a new token the data I generated in the action
@token = Token.new(duration: duration, token: token, check: false, user_id: current_user.id)
This is the Strong Parameters part
def token_params
params.require(:token).permit(:duration, :token, :check, :user_id, :gym_id)
end
And when I check the parameters I passed to the action. Ex.: {"utf8"=>" .... } The "token" hash doesn’t come together, so maybe it’s obvious because I’m not sending anything, other than the button commit.
Thank you, that’s right! ^^
– Diógenes Víctor Rabelo