Why does rails not respect the type of a belongs_to associated object with STI, when its superclass is abstract?
问题 I've come across this rather odd bit of behaviour in a rails application I'm working on. I have multiple types of Post in an inheritance heirarchy, and a Post has_many FeedEntries. class Post < ActiveRecord::Base has_many :feed_entries end class Post::BlogPost < Post; end class Post::Discussion < Post; end class Post::Article < Post; end class FeedEntry < ActiveRecord::Base belongs_to :post end Now, when I have everything set up as before, calling FeedEntry#post on a saved object always