Question: In a Rails 3.2 app, when I call a non-html format on a class - e.g. json, csv, etc - I get an error

```
Template is missing

Missing partial /path/to/template with {:locale=>[:en], :formats=>[:json].....

```

The template is called from a method in the controller.

How can I create a conditional statement in the controller that does something like:

```
if format is html
  my_method_that_causes_the_error
end

```

Thanks

Answer: 
In your controller 

```
   def index # or other method
    ...
    respond_to do |format|
      format.html # render index.html.erb
      format.json { render json: ...} # one-line block
      format.xml do 
        # multi-line block
      end
    end
  end

```
Is maybe [this](http://apidock.com/rails/ActionController/MimeResponds/InstanceMethods/respond_to) what your are looking for?