[ACCEPTED]-Template is missing-ruby-on-rails
This error happens if you don't redirect 8 in the
create method of your controller.
Are you 7 redirecting in the create method in the 6 controller or rendering the new form, in 5 case of error?
Without the redirection in 4 the create method in the controller, you 3 need to make a new file called
create.html.erb. Usually, after 2 successful creation, you redirect to some 1 other page like shown below
def create # some object you want to create # if the object.save is fine # redirect_to object # else # render new with the errors # end end
In my case I had to process and render no 1 view.
def return_payment # do lots of stuff head :ok end
I had the same problem and the reason was 2 that I left accidentally other empty 'create' method 1 :)
Generally missing template error occurs 9 -when you don't have view file of that 8 method of controller, or -if a method is 7 just for calculation that does not have 6 any view file, then you must have to render/redirect 5 the method.
If you do not render or redirect 4 the method, it will search for the view 3 page of current method name (in your case 2 it will search for create.html.erb).So, you 1 have to render/redirect the method.
I had the same problem and just added the 1 redirect_to and it worked!
def update @visitor = Visitor.find(params[:id]) if @visitor.update_attributes(visitor_params) flash[:notice] = "Update ok!" redirect_to root_path #just added this line and it worked! else render 'edit' end end
More Related questions