piotrmurach / loaf

Manages and displays breadcrumb trails in Rails app - lean & mean.
MIT License
407 stars 24 forks source link

loaf incorrectly marking routes as active when using polymorphic routing #39

Closed jamesla closed 5 years ago

jamesla commented 5 years ago

Describe the problem

Routes incorrectly being marked as active when using polymorphic routing .

Steps to reproduce the problem

both links will be marked as active although only one path is actually correct

breadcrumb @point.debate.title, debate_path(params[:debate_id])
breadcrumb @point.summary, debate_point_path(params[:debate_id], @point)

only active link is active

breadcrumb @point.debate.title, debate_path(params[99999])
breadcrumb @point.summary, debate_point_path(params[:debate_id], @point)

Actual behaviour

Both routes are being marked as active even though only one route is actually in use

Expected behaviour

Only the active route should be marked as active

Does anybody know if there is a way to make this work?

jamesla commented 5 years ago

fixed with match: :exact oops should have read the docs better

piotrmurach commented 5 years ago

Hi James,

Thanks for using loaf. 🙇

You can also configure this setting for all your breadcrumbs here. In the future release I may consider changing the default to :exclusive match. However, it's fully configurable so people can easily change this behaviour.