I have never used STI with AR but I am now considering it. My question has to do with the Base.inheritance_column. According to the api docs:
Active Record allows inheritance by storing the name of the class in a > column that by default is named “type” (can be changed by overwriting > Base.inheritance_column). > Can one assign a value within the subclass to use in the inheritance_column in place of the class name? For example, given: class Transaction < ActiveRecord::Base end class ArClientInvoice < Transaction end Is there any way to arbitrarily set ArClientInvoice.type to "ARIN" for all occurrences and to have Active record use this for STI purposes in place of "ar_client_invoice"? The use case for this is for compatibility with a non-Rails application. The simple answer is to rename the class to ARIN < ActiveRecord::Base and to add *inflect.acronym '**ARIN'* in config/initializers/inflections.rb. > Or I could create a separate column which always gets initialised and > locked to *'**ARIN'* in ArClientInvoice and then pass that to the > external application*. *But I was sort of hoping that there would be a > way to have my class name and pass ARIN as the type too. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d8dcc9b9-d534-492d-8967-5238e005246e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

