# Problem with acts\_as\_sti\_factory plugin

**URL:** <https://www.ruby-forum.com/t/problem-with-acts-as-sti-factory-plugin/123233>\
**Category:** Rails\
**Created:** [December 15, 2007, 8:26am UTC](https://www.ruby-forum.com/t/problem-with-acts-as-sti-factory-plugin/123233 "2007-12-15T08:26:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vidya1111](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b3f665/32.png) [@vidya1111](https://www.ruby-forum.com/u/vidya1111)\
**Post date:** [December 15, 2007, 8:26am UTC](https://www.ruby-forum.com/t/problem-with-acts-as-sti-factory-plugin/123233/1 "2007-12-15T08:26:54Z")

</div>

When I have the subclasses in the parent class file itself I am able to  
get the names of the subclasses using \<Class\_name\>.type\_options using  
acts\_as\_sti\_factory plugin.

But if each of the subclass is a separate rb file then type\_options is  
not getting the sub class name.

Example: In my sort\_field.rb, I have

class SortField \< ActiveRecord::Base  
def self.inheritance\_column  
‘sort\_type’  
end  
end

class AscendingSortField \< SortField  
end

class DescendingSortField \< SortField  
end

Now SortField.type\_options would fetch me the names of the subclasses.

But if I have the subclasses in a separate file such as  
ascending\_sort\_field.rb and descending\_sort\_field.rb the same does not  
help.

Please help me…
