Problem with link_to_remote, RJS and jRails

Hi, everyone,

I’m trying to update the content of a div using link_to_remote and RJS
template.
Everything works fine if I use the default Prototype/Scriptaculous
libraries, but I want to use jRails 'coz other parts of my application
use a lot of jQuery.
Here are the steps I done:

  1. inside StatesController.rb I defined the following action:
    def update_view

do nothing just render the default template, in my case a RJS

template
end

  1. here’s the whole update_view.rjs file:
    page.insert_html :bottom, ‘result_view’, “Hello, World!

  2. inside show.html.haml (I really don’t like erb):
    = link_to_remote ‘update view’, :url => { :action => :update_view }
    #result_view

  3. here is what I get in log/development.log when using Prototype/
    Scriptaculous:
    Parameters:
    {“authenticity_token”=>“60e55877a4b807f568824ed36c5849e95dc07607”,
    “action”=>“update_view”, “controller”=>“states”}

  4. here is what I get in log/development.log when using jRails
    Parameters:
    {“authenticity_token”=>“60e55877a4b807f568824ed36c5849e95dc07607”,
    “action”=>“show”, “id”=>“update_view”, “controller”=>“states”,
    “_”=>“1216305965026”}

The action called is “show” (the current one) instead “update_view”.

I know it must be a jRails issue, and should post in jRails list, but
I believe someone here could help me faster.

Thanks

On 17 Jul 2008, at 16:53, Samflores wrote:

“action”=>“show”, “id”=>“update_view”, “controller”=>“states”,
“_”=>“1216305965026”}

The action called is “show” (the current one) instead “update_view”.

I know it must be a jRails issue, and should post in jRails list, but
I believe someone here could help me faster.

Going up a level, what url are the two things hitting?

Fred

Did you by chance make a call to jQuery.noconflict() to prevent
Prototype and jQuery from conflicting before you dropped in jRails?

The URL that contains the link_to_remote is http://localhost/states/1
(showing a state)

The generated html for link_to_remote is:

  1. for default rails librarires:
    <a href=“#” onclick="new Ajax.Request(‘/states/update_view’,
    {asynchronous:true, evalScripts:true, parameters:‘authenticity_token=’
  • encodeURIComponent(‘0b492fd8ce19923563c844fe68d869c45b475b6d’)});
    return false;">update
  1. for jRails:
    update</
    a>

both are pointing to same URL: /states/update_view