# Passing class name

**URL:** <https://www.ruby-forum.com/t/passing-class-name/74334>\
**Category:** Rails\
**Created:** [November 4, 2006, 7:31pm UTC](https://www.ruby-forum.com/t/passing-class-name/74334 "2006-11-04T19:31:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/d07c76/32.png) [@nicken](https://www.ruby-forum.com/u/nicken)\
**Post date:** [November 4, 2006, 7:31pm UTC](https://www.ruby-forum.com/t/passing-class-name/74334/1 "2006-11-04T19:31:20Z")

</div>

Hey,

I want to pass this class object in the var “item”  
\<%= render :partial =\> ‘/shared/form\_system\_attributes’, :locals =\> {  
:item =\> @album, :edit =\> true, :publish =\> true } -%\>

this can be (these are objects):  
:item =\> @album  
:item =\> @product  
:item =\> @album\_category

In \_form\_system\_attributes.rhtml I do

\<%= check\_box item.class.to\_s.downcase, “publish”, {:size =\> 1} %\>

this gives:  
  
  
 ==\> this in incorrect: it should be  
album\_category

Is there anything other than item.class for getting the classname with  
underscores, like the model filename.

Thx

N.

---

<div class="post-metadata">

**Author:** ![nicken](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/d07c76/32.png) [@nicken](https://www.ruby-forum.com/u/nicken)\
**Post date:** [November 4, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/passing-class-name/74334/2 "2006-11-04T19:44:15Z")

</div>

Try the underscord method (ie “CamelCase”.underscore gives “camel\_case”)

Fred
