Passing class name

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.

Try the underscord method (ie “CamelCase”.underscore gives “camel_case”)

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs