I have a create action in the controller that I use for a form on the user page as well as in the user index. I want to redirect to the same page the user is on when submitting the form after the form is submitted. This is what I have right now and the form only redirects to @user or '/users'. How can I get it so the user goes back to the page they submitted the form from?
def create
@user = User.find(params[:relationship][:followed_id])
current_user.follow!(@user)
redirect_to @user or '/users'
end
redirect_to new