Change ActiveRecord::Base.inheritance_column in a rails app
Asked Answered
J

1

12

I want to use Single Table Inheritance using a column other than type. According to the Rails documentation - http://api.rubyonrails.org/classes/ActiveRecord/Base.html, I can do this by modifying ActiveRecord::Base.inheritance_column. How can I do this?

Jackal answered 29/11, 2013 at 23:53 Comment(0)
D
19

Try the following:

class MyModel < ActiveRecord::Base
    self.inheritance_column = 'column_that_is_not_type'
end

Your migrations should work everywhere.

Dubitation answered 30/11, 2013 at 0:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.