Respond_with not working Rails 3

Posted by MDM on Stack Overflow See other posts from Stack Overflow or by MDM
Published on 2010-11-02T14:12:53Z Indexed on 2011/03/20 19:20 UTC
Read the original article Hit count: 143

Filed under:

As no one can help me with my UJS ajax problem I am trying "respond_with", but I am getting this error:

RuntimeError (In order to use respond_with, first you need to declare the formats your controller responds to in the class level)

Yet I have declared it in my controller:

class HomepagesController < ApplicationController
  respond_to :html, :xml, :js

  def index
    @homepages = Homepage.search(params[:search])
    respond_with(@homepages)
  end

Anyone has any ideas why.

© Stack Overflow or respective owner

Related posts about ruby-on-rails