Rails STI: How to change mapping between class name & value of the 'type' column

You can try something like this:

class Proyect < ActiveRecord::Base
end

Then the Indoor class but with Other name

class Other < Proyect
  class << self
    def find_sti_class(type_name)
      type_name = self.name
      super
    end

    def sti_name
      "Indoor"
    end
  end
end

The same apply for Outdoor class. You can check sti_name in http://apidock.com/rails/ActiveRecord/Base/find_sti_class/class


In looking at the source code there seems to be a store_full_sti_class option (I don't know when it was introduced):

config.active_record.store_full_sti_class = false

That gets rid of the namespacing modules for me in Rails 4.2.7