I have a jQuery script that looks like:
$.ajax({
url: "/books/"+ mId,
type: 'PUT',
dataType: 'json',
data: { book: { description: bValue } },
}).done(function() {
alert("DONE!");
});
In my routes, I have resources :books
In my book controller, I have the following:
def update
@book = Book.find params[:id]
respond_to do |format|
if @book.update(book_params)
format.json { render status: 200 }
else
format.json { render status: :unprocessable_entity }
end
end
end
But for some reason, I get the following error:
ActionView::MissingTemplate (Missing template books/update, application/update with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}.
Aucun commentaire:
Enregistrer un commentaire