Simple Routing Error

Hello there,

I want to display a help icon and when users click it a simple static page to open in a pop-up.

In My View I have:

<%= link_to image_tag("info_small.gif") , { :action => "help", :controller => "restaurants"}, :popup => ['new_window', 'height=300,width=600'] %>

In My Controller I have:

def help @message = 'hello' end

I have a help.rhtml file with some static text. Every time I click on the image I get the following error in the pop up menu:

Couldn't find Restaurant with ID=help

Any Idea whats going on and how I can fix it?

Thanks, steve

Steve Glaz wrote:

Couldn't find Restaurant with ID=help

This means you have RESTful routes. By default, the line:

map.resources :restaurants

means you have just 7 actions available:

#index, #new, #create, #edit, #update, #destroy, #show

To use more actions, you need to specify them in config/routes.rb with something like:

map.resources :restaurants, :collection => {:help => :get}

For more info:

http://api.rubyonrails.com/classes/ActionController/Resources.html#M000308

Thanks for the tip. Seems to work now.

Thanks, steve

Mark Bush wrote: