I'm trying to add current_user to a newly created item. I could do this is a controller, but seems would result in lots of mucking getting strong params to work. Docs seem to suggest this type of stuff done in the resources?
So I was thinking of adding in an after_create in the resource file but current_user is not available there. I thought that doing something like this in base ApplicationController:
def context
{current_user: current_user}
end
would expose current_user in the context in a resource but doesn't seem to be the case.
Suggestions?
I'm trying to add current_user to a newly created item. I could do this is a controller, but seems would result in lots of mucking getting strong params to work. Docs seem to suggest this type of stuff done in the resources?
So I was thinking of adding in an after_create in the resource file but current_user is not available there. I thought that doing something like this in base ApplicationController:
def context
{current_user: current_user}
end
would expose current_user in the context in a resource but doesn't seem to be the case.
Suggestions?