Re: "respond_with" not working Rails 3

MDM
2010-11-02T14:09:23Z

A certain Javix suggested:-
  I think, may be I''m wrong, - the problem is how you defined it in
your routes.rb file. If you defined homepages as

  resources :homepages

  Rails will try to match that resource to any non-XHR (not Ajax
request) for action ''index''; If it''s true, I think
you will have to
redefine resources for homepages.

I have not heard of this can anyone shed some light for me please.

On Nov 2, 11:38 am, MDM <don.m...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> 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.

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at