Link_to_remode :id

Hi,

After using rails for a while, I’ve decided to ‘sex-up’ my apps using
the built in AJAX support.

I seem to have struck a problem which is probably my own oversight.

When I make a call to link_to_remote, I want to send an :id to the
action. When this is handled by a stadard link_to call, it’s fine.
Using link_to_remote causes the error: ‘You have a nil object when you
didn’t expect it!’.

In summary:

<%= link_to ‘Capabilities’, :action => ‘capabilities’, :id => @mything
%>

…is OK, but…

<%= link_to_remote(“Capabilities”,
:update => ‘mydiv’,
:url => { :action => ‘capabilities’, :id => @mything }) %>

…does not.

Maybe i’m just too old and my head is wired for Web 1.0 :slight_smile:

Thanks for any help anyone can give.

Hi –

On Sat, 21 Oct 2006, karma_guru wrote:

Using link_to_remote causes the error: 'You have a nil object when you
:update => ‘mydiv’,
:url => { :action => ‘capabilities’, :id => @mything }) %>

…does not.

Where is the error being raised from?

David


David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs