need help named route and link_to



In my application I’ve set up a custom route that works as long as I

stay within the same model. This makes me think that I must have

something wrong with the route.

map.agent ‘:agent’, :controller => ‘agents’, :action => ‘show’

The resulting url is

The problem that I have is creating a link_to from a view outside of

agents. I currently have this, but this will

<%= link_to_unless(@property.agent.nil?, “view bio”,

@property.agent.permalink) %> generates this:

Can’t you do this? <%= link_to_unless(@property.agent.nil?, “view bio”, {agent_url, :name => @property.agent}) %> or whatever your name would default to

Sorry, it’s tough for me to guess with just this. As a check, you can replace {agent_url, :agent => @property.agent.permalink} with {:controller => ‘agents’, :action => ‘show’, :agent => @property.agent.permalink} and see if that works.