I have a form for creating materials (title, description and content – all basic). The form saves these details just fine but it doesn’t save the user_id, which should be the user_id of the current_user. How do I do this? It must be easy but nothing has worked so far.
def create
@material = Material.new(params[:material])
if @material.save
flash[:success] = "Content Successfully Created"
redirect_to @material
else
render 'new'
end
end
1 Answer