Martyn W. wrote in post #1063043: > Michael Pavling wrote in post #1062778: >> On 1 June 2012 04:31, flaps <flaps2...@gmail.com> wrote: >>> THanks for your response. The validation methods are not called on a >>> create, allowing the save method to be called, unprotected. I dont >>> want the save to be called let alone fail. >> >> Is there any chance you could post your controller code. I wonder >> whether you've got a ".save false" in the create action... > > Here is the create code in the controller: > > # POST /works > # POST /works.json > def create > @work = Work.new(params[:work]) > @operations = @work.work_ticket.part.operations > respond_to do |format| > if @work.save > format.html { redirect_to @work, notice: 'Work was successfully > created.' } > format.json { render json: @work, status: :created, location: > @work } > else > format.html { render action: "new" } > format.json { render json: @work.errors, status: > :unprocessable_entity } > end > end > end
It looks like the validation is called, it is the render after the failed fail that errors out now. I get the following error in the browser: Routing Error No route matches {:controller=>"works"} Try running rake routes for more information on available routes. All the routes for Work are working, except in this case after a failed invalid save. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.