I have a form in my Rails app with a very straightforward controller and if the form cannot save, I'd like to render :new to show the errors:
def create
@health_profile = HealthProfile.new(health_profile_params)
if @health_profile.save
redirect_to :somewhere_else
else
render :new
end
end
This works great, but the URL goes from /health_profiles/new to /health_profiles following the attempt to create a record. Is there a way to call render :new and have the URL reflect that the user is at /health_profiles/new? If they were to refresh the page while the URL shows /health_profiles, it would load the :index which is not what I want.