# Problems with jRails and ajax helpers

**URL:** <https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335>\
**Category:** Rails\
**Created:** [April 12, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335 "2009-04-12T16:46:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brentmc79](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@brentmc79](https://www.ruby-forum.com/u/brentmc79)\
**Post date:** [April 12, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335/1 "2009-04-12T16:46:56Z")

</div>

I working on a Rails 2.2.2 app that uses jRails and any time I attempt  
to use a Rails ajax helper, I get the following error:

index 116545 out of string

with this stack trace:

vendor/plugins/jrails/lib/jrails.rb:197:in `[]=' vendor/plugins/jrails/lib/jrails.rb:197:in`build\_callbacks’  
vendor/plugins/jrails/lib/jrails.rb:119:in `options_for_ajax' vendor/plugins/jrails/lib/jrails.rb:51:in`remote\_function’

I verified that the no conflict snippet is included in the application  
layout, and all libraries are up to date.

Does anyone have any idea what the problem might be?

---

<div class="post-metadata">

**Author:** ![brentmc79](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@brentmc79](https://www.ruby-forum.com/u/brentmc79)\
**Post date:** [April 12, 2009, 4:59pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335/2 "2009-04-12T16:59:01Z")

</div>

Brent C. wrote:

> vendor/plugins/jrails/lib/jrails.rb:51:in `remote\_function’
> 
> I verified that the no conflict snippet is included in the application  
> layout, and all libraries are up to date.
> 
> Does anyone have any idea what the problem might be?

What’s on line 197? I don’t get a string with a []=, so I might have a  
different  
version. Whatever it is, you might debug and monkey-patch it, then  
submit the patch.

The authors of jrails.rb deserve to have this question on their mailing  
list or  
home forum…

---

<div class="post-metadata">

**Author:** ![brentmc79](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@brentmc79](https://www.ruby-forum.com/u/brentmc79)\
**Post date:** [April 12, 2009, 5:00pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335/3 "2009-04-12T17:00:46Z")

</div>

Brent C. wrote:

> Does anyone have any idea what the problem might be?

Also, jrails does not ship with tests. I ought to remember to check them  
before  
adding a plugin…

---

<div class="post-metadata">

**Author:** ![brentmc79](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@brentmc79](https://www.ruby-forum.com/u/brentmc79)\
**Post date:** [April 12, 2009, 5:15pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335/4 "2009-04-12T17:15:01Z")

</div>

I’ve submitted the problem to the jRails people here:  
[http://code.google.com/p/ennerchi/issues/detail?id=41](http://code.google.com/p/ennerchi/issues/detail?id=41)

---

<div class="post-metadata">

**Author:** ![brentmc79](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@brentmc79](https://www.ruby-forum.com/u/brentmc79)\
**Post date:** [April 13, 2009, 5:13pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335/5 "2009-04-13T17:13:55Z")

</div>

Brent C. wrote:

> I figured it out. I was passing in a url as an argument as a string,  
> not as a hash with a :url key. So really, jRails isn’t broken, BUT it  
> should give me some sort of meaningful error, instead of just blowing  
> up, when passed invalid arguments.

Actually, helpers like remote\_function should accept either a :url=\>{}  
with  
parts or a string. That lets you use named routes…

---

<div class="post-metadata">

**Author:** ![brentmc79](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@brentmc79](https://www.ruby-forum.com/u/brentmc79)\
**Post date:** [April 13, 2009, 5:04pm UTC](https://www.ruby-forum.com/t/problems-with-jrails-and-ajax-helpers/165335/6 "2009-04-13T17:04:18Z")

</div>

I figured it out. I was passing in a url as an argument as a string,  
not as a hash with a :url key. So really, jRails isn’t broken, BUT it  
should give me some sort of meaningful error, instead of just blowing  
up, when passed invalid arguments.
