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