# Controller.controller\_name for the controller name. But how

**URL:** <https://www.ruby-forum.com/t/controller-controller-name-for-the-controller-name-but-how/74707>\
**Category:** Rails\
**Created:** [November 7, 2006, 10:53am UTC](https://www.ruby-forum.com/t/controller-controller-name-for-the-controller-name-but-how/74707 "2006-11-07T10:53:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gesen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f1d935/32.png) [@Gesen](https://www.ruby-forum.com/u/Gesen)\
**Post date:** [November 7, 2006, 10:53am UTC](https://www.ruby-forum.com/t/controller-controller-name-for-the-controller-name-but-how/74707/1 "2006-11-07T10:53:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gesen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f1d935/32.png) [@Gesen](https://www.ruby-forum.com/u/Gesen)\
**Post date:** [November 7, 2006, 10:53am UTC](https://www.ruby-forum.com/t/controller-controller-name-for-the-controller-name-but-how/74707/2 "2006-11-07T10:53:17Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Gesen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f1d935/32.png) [@Gesen](https://www.ruby-forum.com/u/Gesen)\
**Post date:** [November 7, 2006, 10:53am UTC](https://www.ruby-forum.com/t/controller-controller-name-for-the-controller-name-but-how/74707/3 "2006-11-07T10:53:19Z")

</div>

Ahh, that was easy, thanks!
