Pregunta

I have a situation where I am trying to call:

%li{class: current_page?("/photos")  && 'current'}
  = link_to "Life Story", legacy_legacy_path(@legacy.slug), :class => "legacy"

where the current url (which I'm trying to target looks like):

...com/scooby-doo/photos

Where 'scooby-doo' in this case, is a dynamic parameter.

Is there any way I can just query the URL for the last part? I.E. /photos

¿Fue útil?

Solución

You should be able to add the path_name and it will work for all :id's, not just scooby-doo. So if you did a rake routes, and told me what this particular path_name looks like, I could help further. Prob something like current_page?(photo_legacy_path(@legacy))

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top