Topic: Passing variables to action using Ajax.Updater

Hi, I seem to be having a problem with Ajax.Updater passing variables correctly. I have a Ajax call that does this:

<%= link_to item.name, {:action => "#"}, {"onmouseover" => "new Ajax.Updater('display_stuff', 'display', {parameters:'client=IBM'})"} %>

My 'display' action only has one line:

def display
    @client = params[:client]
end

Looking at the log, the variable seems to have been passed correctly:

Processing DisplayController#display (for 127.0.0.1 at 2007-07-29 22:58:06) [GET]
  Session ID: a724b690db0cfe794dd1c3821cbf0919
  Parameters: {"client"=>"IBM", "action"=>"display", "controller"=>"display"}

Any idea, anyone?

Re: Passing variables to action using Ajax.Updater

I'm confused to what the problem is. Could you elaborate?

Re: Passing variables to action using Ajax.Updater

Sorry, wasn't being too clear. The problem is - that Ajax.Updater calls action 'display' on the controller 'display'. The call happens correctly, and everything is peachy - except the 'display' action cannot see the "client" variable that's been passed from Ajax.Updater.

Re: Passing variables to action using Ajax.Updater

Any clue, anybody?

Re: Passing variables to action using Ajax.Updater

can we see the rjs?

edit:

what happens when you do

  def display
    @client = params[:client]
    render :update do |page|
      page.alert @client
    end
  end

Last edited by pjleonhardt (2007-07-30 23:13:48)

Re: Passing variables to action using Ajax.Updater

Nothing happens when I do that, unfortunately.

Hmm, as far as RJS, I'm pretty sure I'm not using it ... What do you mean?

Re: Passing variables to action using Ajax.Updater

I have a demo tomorrow and I still haven't figured this out... I have a suspicion that this must be something incredibly stupid. Any idea, anyone?

Re: Passing variables to action using Ajax.Updater

Ha! Figured it out.

I was right - the matter IS incredibly stupid. Earlier in the controller, I put a helper method that said:

private
def do_something
   ...
end

I know, I know, that method shouldn't even be there, it should be in the model. It's all Java's fault, I tell ya (Java is my day job.)

Well, all's well that ends well!