Rails 3 ajax call - ActionView::MissingTemplate

I am trying to make an ajax call but I don't want to return any data, or perhaps only return a 200.

My error is

ActionView::MissingTemplate (Missing template ....

My ajax method in the controller is...

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

Is there a way to tell rails to return nothing, without creating an extra template file?

BTW i am making the ajax call by using jquery's $.post method in a js file.

Answers


You can render nothing with:

render :nothing => true

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


first of all, please use ruby style syntax and write your methods in snake_case!

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


Need Your Help

Request["key"] vs Request.Params["key"] vs Request.QueryString["key"]

c# asp.net request.querystring

Request["key"] vs Request.Params["key"] vs Request.QueryString["key"]

How do you write tests for the argparse portion of a python module?

python unit-testing argparse

I have a Python module that uses the argparse library. How do I write tests for that section of the code base?