Link_to_remote: valid use?

hello,

I am using link_to_remote to call an RJS method (via a controller
method). Here is my view code:

<%= link_to_remote ‘Explode’, :url => { :action =>
:show_property_children, :id => property, :is_collection => true } if
property.class == PropertyCollection %

I’d like to pass across two parameters, :id and :is_collection. Is this
the correct way of doing so? ie. within :url

My code works fine but I’ve a nagging feeling it’s not the correct way
to pass these parameters.

Please note that I reference id in my controller method
‘show_property_children’ using params[:id]

Also, I see that the signature for link_to_remote accepts
html_options={} - what is this typically used for? I could not find
guidance in the documentation.

Thanks.

Hi,
I belive its fine, but you should setup the route for that action:
map.connect ‘controller_name/
show_property_children/:id/:is_collection’, controller=>
‘controller_name’, :action=>
‘show_property_children’, :id=>nil, :is_collection=>false/true

Hope it works for u

On Oct 8, 2006, at 12:42 PM, Lee wrote:

hello,

I am using link_to_remote to call an RJS method (via a controller
method). Here is my view code:

<%= link_to_remote ‘Explode’, :url => { :action =>
:show_property_children, :id => property, :is_collection => true } if
property.class == PropertyCollection %

I’d like to pass across two parameters, :id and :is_collection. Is this
the correct way of doing so? ie. within :url

My code works fine but I’ve a nagging feeling it’s not the correct way
to pass these parameters.

Please note that I reference id in my controller method
‘show_property_children’ using params[:id]

Also, I see that the signature for link_to_remote accepts
html_options={} - what is this typically used for? I could not find
guidance in the documentation.

Thanks.

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