I am using simple navigation and I am trying to define a path:
sub_nav.item t.id,
t.h1.force_encoding("UTF-8"),
tag_path( d.slug, t.slug,
params.merge(:tag_id => t.id, :page => nil)
)
I want to merge the params, but I get the error:
No route matches {:controller=>"kategoris", :action=>"show", :view=>"boks",
:id=>"vind-gavekort", :tag_id=>26, :page=>nil,
:kategori=>"gavekort-konkurrencer"}
If I change it to:
sub_nav.item t.id,
t.h1.force_encoding("UTF-8"),
tag_path( d.slug, t.slug, :tag_id => t.id, :page => nil )
It works, but the params are not merged.
Routes:
match '/:id' => 'kategoris#show', :as => 'katshow'
match ':kategori/:id' => 'tags#show', :as => 'tag'
Check :controller and :action values are not messing around when merging other custom params.
Try this:
params.except(:controller, :action).merge(:tag_id => t.id, :page => nil)