adjust ActiveRecord::Base.all_models for rails3
the old method included Profile but excluded CourseProfile. but in rails3, Profile.table_name is nil because it's an abstract class; including it meant trying to truncate table "" in spec_helper.rb, but excluding it without including CourseProfile meant the "profiles" table didn't get truncated. update the model listing to exclude abstract classes (e.g. Profile), but include direct descendants of abstract classes (e.g. CourseProfile), but not direct descendants of non-abstract classes (e.g. Announcement). Change-Id: I4e6a60b302f1c88f4ace0c7d41377e92eeecfaa1 Reviewed-on: https://gerrit.instructure.com/27087 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: Jacob Fugal <jacob@instructure.com> Product-Review: Jacob Fugal <jacob@instructure.com>
This commit is contained in:
parent
34893f80bd
commit
beb81fa1f0
|
@ -26,7 +26,9 @@ class ActiveRecord::Base
|
|||
@all_models = (ActiveRecord::Base.send(:subclasses) +
|
||||
ActiveRecord::Base.models_from_files +
|
||||
[Version]).compact.uniq.reject { |model|
|
||||
model.superclass != ActiveRecord::Base || (model.respond_to?(:tableless?) && model.tableless?)
|
||||
!(model.superclass == ActiveRecord::Base || model.superclass.abstract_class?) ||
|
||||
(model.respond_to?(:tableless?) && model.tableless?) ||
|
||||
model.abstract_class?
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue