# Converting rails 2 to 3 remote\_function error

**URL:** <https://discuss.rubyonrails.org/t/converting-rails-2-to-3-remote-function-error/57079>\
**Category:** rubyonrails-talk\
**Created:** [February 2, 2011, 1:26am UTC](https://discuss.rubyonrails.org/t/converting-rails-2-to-3-remote-function-error/57079 "2011-02-02T01:26:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob1](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Rob1](https://discuss.rubyonrails.org/u/Rob1)\
**Post date:** [February 2, 2011, 1:26am UTC](https://discuss.rubyonrails.org/t/converting-rails-2-to-3-remote-function-error/57079/1 "2011-02-02T01:26:44Z")

</div>

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 remote\_function.

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:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ActionController::RoutingError in Rcg#index

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Showing /Users/bertke/dev/rcg/app/views/layouts/rcg.html.erb where line #32 raised:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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!
