# Getting class name in plugin

**URL:** <https://www.ruby-forum.com/t/getting-class-name-in-plugin/176271>\
**Category:** Rails\
**Created:** [September 28, 2009, 10:48am UTC](https://www.ruby-forum.com/t/getting-class-name-in-plugin/176271 "2009-09-28T10:48:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![artchrst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@artchrst](https://www.ruby-forum.com/u/artchrst)\
**Post date:** [September 28, 2009, 10:48am UTC](https://www.ruby-forum.com/t/getting-class-name-in-plugin/176271/1 "2009-09-28T10:48:49Z")

</div>

Hi Guys,

I am writing a plugin that has a “has\_many” relationships via a  
join\_table.

It is polymorphic so I need to filter the class name. How can I get the  
extending class’s name in the plugin in?

e.g.

has\_many :contents\_states, :conditions =\> {"content\_type  
=#{self.class.name}  
}

Thanks!

Arthur
