Rendering fails (Ajax - problem?)

Dear Rubys,

I have question (difficult to me but maybe easy to answer for you).
I have a link_to_remote() in my view which activates an action (say
“filter()”). In this action something is done (maybe a
“Test.find(:all)”). Now I want to pass these items to another action (I
made it with render(:action => ‘list’)), which paginates theses items
and loads the view, that belongs to the action. But because of Ajax no
view is visible. I have no clue why.
Maybe the second action (list) is never rendered?
But how is it possible to realise this request?
Maybe a workaround for rendering (as the existing for redirect_to()
http://www.height1percent.com/articles/2006/04/10/http-302-redirects-xmlhttprequests-argh-1
)?

Any hint would be great.

Best regards
Chris

Hi Christian,

Christian R. wrote:

I have a link_to_remote() in my view which activates an action (say
“filter()”). In this action something is done (maybe a “Test.find(:all)”).
Now I want to pass these items to another action (I made it with
render(:action => ‘list’)), which paginates theses items and loads the
view, that belongs to the action. But because of Ajax no
view is visible. I have no clue why.

The key is to understand what you’re trying to do in the context of the
Rails request/response cycle. It’s also somewhat important to
understand
that a Rails app ‘lives’ for exactly one request/response cycle. Rails
treatsevery request as though it was the first it’s heard of anything.
In
this case, the browser has sent a request to the server that tells the
server, via the message type, that it expects an executable response.
The
server, on the other hand, will send back whatever your application
tells it
to send back. If you tell your app to send back html instead of js, it
will. And the browser will ‘execute’ the html which will result in
exactly
what you’re seeing: nothing.

Maybe the second action (list) is never rendered?

I recommend you download and begin using Firebug. Then you’ll be able
to
see exactly what’s being requested and rendered. You are using Firefox,
aren’t you?

But how is it possible to realise this request?

To get a good start, I recommend Cody F.'s RJS tutorial on O’Reilly.
Excellent material at a ‘duh’ price.

Any hint would be great.

HTH,
Bill

PS. If you decide you want more than a hint, feel free to ask :wink: It’s
a
very helpful list.