%F2 in URLs after upgrade

Hi All,

I recently upgraded a rails app to 2.0.2 and I’m having an issue when
I build URLs to edit specific items. It seems I’m getting %2F instead
of the slash and this causes the controller to not recognize the
action. Here’s some code from an RHTML file:

Please select the specific resource

Region: <%= @region %>

<% for resource in @all_resources %> <% if @region == resource.region.Name %>

<%= nav_link "#{resource.Name}", "Admin", "skills/ #{resource.id}" %>

<% end %>

<%end %>

Instead of /admin/skills/84 I get /admin/skills%F284

which then gives me this:

Unknown action
No action responded to skills/84

There must have been a change in the upgrade but I can’t find anything
after lots of searching.

Thanks,

Tom

Not quite sure what the method nav_link is, some helper you defined
yourself? Makes it difficult without the source of that method to see
how your URL is constructed. Try to see if <%= link_to
“#{resource.Name}”, 'admin/skills/#{resource.id}" %> works first.

Sorry about that. It’s a helper function from the RailsSpace book:

Return a link for use in layout navigation.

def nav_link(text, controller, action=“index”)
link_to_unless_current text, :controller => controller,
:action => action
end

Thanks for responses! I’ve got it under control now and see the err of
my ways.

On Aug 14, 8:08 pm, Tom [email protected] wrote:

Sorry about that. It’s a helper function from the RailsSpace book:

Return a link for use in layout navigation.

def nav_link(text, controller, action=“index”)
link_to_unless_current text, :controller => controller,
:action => action
end

You can’t do it like that. If call call nav_link(“foo”, “bar”, “edit/
1234”) then it will think that the action name is “edit/1234”, and
escape that like a single entity. You will want to pass ‘:id => 1234’
to link_to_unless_current.