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:
<h2>Please select the specific resource</h2>
<h2>Region: <%= @region %></h2>
<% for resource in @all_resources %>
<% if @region == resource.region.Name %>
<h4> <%= nav_link "#{resource.Name}", "Admin", "skills/
#{resource.id}" %></h4>
<% 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.
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
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.