ActiveRecord: query not using correct type condition for STI subclass
问题 I have a set of STI subclasses inheriting from a User base class. I am finding that under certain conditions inside a subclass' definition, queries on the subclasses do not correctly use the type condition. class User < ActiveRecord::Base # ... end class Admin < User Rails.logger.info "#{name}: #{all.to_sql}" # ... end When loading the Rails console in development, it does what I would expect: Admin: SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('Admin') But when hitting the app