Converting rails 2 to 3 remote_function error

I’m still very new to RoR and had built a site for a friend. I’m now
trying to port it to version 3 and am having an issue with

Right now, in a layout file, I have an image_tag and for :onclick I am
using the following:

:onclick => remote_function(:url => { :controller => ‘rcg’, :action =>
‘nav_click’}, :with => ‘pressed=home’

This being just a snippet out of a fairly long image_tag that handles
image switching behavior and then, the idea is to execute a remote
function when clicked.

In the controller ‘rcg’, I have defined a ‘nav_click’ action and then
a nav_click.js.rjs file that ran some ajax code.

When I execute the main page now (I can’t even get to the part where I
would click on something) I get the error:

   ActionController::RoutingError in Rcg#index

   Showing /Users/bertke/dev/rcg/app/views/layouts/rcg.html.erb

where line #32 raised:

   No route matches

{:action=>“nav_click”, :controller=>“rcg”, :escape=>false}

So, first I notice the last line that no route matches and it makes me
wonder if the whole routing thing (which has obviously changed a good
bit) is messed up or if it’s that the remote_function is now somehow
invalid (noting that many of the remote functions have changed
format. Also, I noticed the top line says
‘ActionController::RoutingError in Rcg#index’. But, I don’t really
get why it’s mentioning ‘index’ since this line of ‘code’ is in the
layout and it should just be going to ‘Rcg#nav_click’…right?

My first post so hope this makes sense. Any help on this would be
greatly appreciated. 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