Controller, params, view, routing

controller action - create - takes one param - parent_id and then
renders the view
In the view there’s the following code:

<%= link_to "Admin", {:controller => 'admin', :action => 'index'}, {:title => 'Admin'} %> / <%= link_to "Articles", {:controller => 'cms', :action => 'index'}, {:title => 'Articles'} %> / New article


My problem.

If I use it like this, the urls will look something like
and this part of the breadcrumb

<%= link_to “Articles”, {:controller => ‘cms’, :action => ‘index’},
{:title => ‘Articles’} %>

becomes this

instead of

and the params[:parent_id] is not accessible (nil).

If I define this in routes.rb
map.connect ‘/admin/cms/create/:parent’, :controller => ‘admin/cms’,
:action => ‘create’, :parent => nil

the url looks like this


and the view display correctly.

Any ideea ?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs