# Problem with link\_to\_remote, RJS and jRails

**URL:** <https://www.ruby-forum.com/t/problem-with-link-to-remote-rjs-and-jrails/143363>\
**Category:** Rails\
**Created:** [July 17, 2008, 5:57pm UTC](https://www.ruby-forum.com/t/problem-with-link-to-remote-rjs-and-jrails/143363 "2008-07-17T17:57:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samflores](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@samflores](https://www.ruby-forum.com/u/samflores)\
**Post date:** [July 17, 2008, 5:57pm UTC](https://www.ruby-forum.com/t/problem-with-link-to-remote-rjs-and-jrails/143363/1 "2008-07-17T17:57:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samflores](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@samflores](https://www.ruby-forum.com/u/samflores)\
**Post date:** [July 17, 2008, 6:04pm UTC](https://www.ruby-forum.com/t/problem-with-link-to-remote-rjs-and-jrails/143363/2 "2008-07-17T18:04:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samflores](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@samflores](https://www.ruby-forum.com/u/samflores)\
**Post date:** [August 8, 2008, 11:09pm UTC](https://www.ruby-forum.com/t/problem-with-link-to-remote-rjs-and-jrails/143363/3 "2008-08-08T23:09:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samflores](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@samflores](https://www.ruby-forum.com/u/samflores)\
**Post date:** [July 17, 2008, 6:32pm UTC](https://www.ruby-forum.com/t/problem-with-link-to-remote-rjs-and-jrails/143363/4 "2008-07-17T18:32:11Z")

</div>

The URL that contains the link\_to\_remote is [http://localhost/states/1](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
