controller.controller_name for the controller name. But how do I write to get the current ID?

Hi everyone,

To display the current controller name in a view template you can write <%= controller.controller_name %>. How do you write if you want to display the current ID parameter in a URL like this /pages/show/1?

Many thanks for any answer!

-G

To display the current controller name in a view template you can write <%= controller.controller_name %>. How do you write if you want to display the current ID parameter in a URL like this /pages/show/1?

<%= params[:id] %>

Assuming that's what you called it in your route.

Ahh, that was easy, thanks!