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…