- How to customize Rails 3 STI column name
- class Post < ActiveRecord::Base
- end
- class Question < Post
- end
- class Answer < Post
- end
- class Post < ActiveRecord::Base
- self.inheritance_column = 'type_column_name'
- end
- class Post < ActiveRecord::Base
- scope :questions, where(:post_type_id => 0)
- scope :answers, where(:post_type_id => 1)
- end
- @questions = Post.questions.all
- @answers = Post.answers.all