I use responseers gem to dry my controllers. Here is my current code:
class OfficehoursController < ApplicationController def new @officehour = Officehour.new end def create @officehour = Officehour.create(officehour_params) respond_with(@officehour, location: officehours_path) end def officehour_params params.require(:officehour).permit(:end, :start, :status) end end
The problem I'm facing right now:
When I send valid parameters to create , it redirects to officehours/ , as expected, however, when I get 422 (validation error), it changes the URL from officehours/new to officehours/ (however it remains on the form page .. . idk why). The same thing happens for edit / update actions.
So, I want to stay on .../new or .../edit when I get error 422, how can I do this?
source share