I have an issue with a form sendind two parameters to a controller. I would like that the erb.jstemplate not be triggered if the update of the object fails.
I have added return at the end of my action but the view is still triggered.
Her is the bit of my controller which I think is responsible for actionning the view or not :
if @object.update(some_params)
...
respond_to do |f|
f.html {redirect_to some_path_here}
f.js
end
end
return
That's happens, because according to convention over configuration
Railsautomatically renders action view, if not explicitly specified.In order to avoid rendering, one of the options would be setting head if
@objecthasn't been successfully updated: