Rails 3 ajax call - ActionView :: MissingTemplate

I am trying to make an ajax call, but I do not want to return any data or maybe only return 200.

My mistake

ActionView::MissingTemplate (Missing template .... 

My ajax method in the controller ...

 # Ajax def updatePlayStat() #do something render :layout => false end 

Is there a way to tell the rails to not return anything without creating an additional template file?

BTW I am making an ajax call using the jquery $.post method in the js file.

+4
source share
2 answers

You cannot do anything with:

 render :nothing => true 

See: http://guides.rubyonrails.org/layouts_and_rendering.html#using-render

+24
source

First of all, use ruby ​​style syntax and write your methods in snake_case!

if you just want to return status 200, you can use the head method in your controller: http://apidock.com/rails/ActionController/Head/head

+6
source

All Articles