# File lib/gettext_i18n_rails/model_attributes_finder.rb, line 66 def models if Rails::VERSION::MAJOR >= 3 Rails.application.eager_load! # make sure that all models are loaded so that direct_descendants works descendants = ::ActiveRecord::Base.direct_descendants # In rails 5+ user models are supposed to inherit from ApplicationRecord if defined?(::ApplicationRecord) descendants += ApplicationRecord.direct_descendants descendants.delete ApplicationRecord end descendants else ::ActiveRecord::Base.connection.tables \ .map { |t| table_name_to_namespaced_model(t) } \ .compact \ .collect { |c| c.superclass.abstract_class? ? c.superclass : c } end.uniq.sort_by(&:name) end