In Rails 3, it was possible to insert an attribute into params like so:
params[:post][:user_id] = current_user.id
I'm attempting to do something similar in Rails 4, but having no luck:
post_params[:user_id] = current_user.id
. . . .
private
def post_params
params.require(:post).permit(:user_id)
end
Rails is ignoring this insertion. It doesn't throw any errors, it just quietly fails.
deep_merge
within the params constructor? Or elsewhere in your controller? – Syreetasyria