[newbie]how to use link_to to link to another controller?

I am just diving into Rails and I am a bit puzzled by the link_to
function.

am writing an app to display my photographs in categories. My
application layout
has a sidebar to show a menu with categories from the categories table
in the
database (like in taken from the tutorials), to be shown on every page.

I managed to get a global @menu_categories object that keeps track of
all the
categories that should pop up in the menu using in the application
controller
def initialize
@menu_categories=Category.find_all
end

Now, if I iterate over these menu categories in the application template
<% for menu_category in @menu_categories %>
<% link_to menu_category.category, :action =>‘list_photos’,:id
=>menu_category%>

<% end %>

I get the following links:
http://192.168.1.100:8000/categories/list_photos/3 (when in categories
conroller)
http://192.168.1.100:8000/photos/list_photos/3 (when in photos
controller)

What I want however is to have the second link always, regardles where I
am in
the app. So How do I instruct the link_to helper to always link to a
specific
controller in the app?

Cheers VidJa

<%= link_to :controller => “category”, :action => “list_photos”, :id =>
IDHERE %>

~Ben

Possibly:
<% link_to menu_category.category, {:controller => ‘your_controller’,
:action =>‘list_photos’, :id=>menu_category}%>

Thanks Ben and Dylan,

it works. I have been looking at the API docs before, but actually I
can’t find the info for the controller option.
After some digging this morning I found that the link in the link_to
section probably should lead to
http://api.rubyonrails.com/classes/ActionController/Base.html#M000174
instead of
http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000304
since that is where the options are eplained.
Maybe that was the reason I couldn’t find it?

Anyway, many thanks. Ruby aint bad as a the second language after php to
learn

Ben R. wrote:

Dylan has it … forgot to include the “title” field…

Be sure to use the API Docs. They are very helpful:

Peak Obsession<
link_to info…

Dylan has it … forgot to include the “title” field…

Be sure to use the API Docs. They are very helpful:

Peak Obsession<
link_to info…