Commit 77c1d87f authored by Sean McGivern's avatar Sean McGivern

Make resetting column information overridable in EE

parent 6f7702bf
...@@ -25,14 +25,19 @@ module MigrationsHelpers ...@@ -25,14 +25,19 @@ module MigrationsHelpers
clear_schema_cache! clear_schema_cache!
# Reset column information for the most offending classes **after** we # Reset column information for the most offending classes **after** we
# migrated the schema up, otherwise, column information could be outdated # migrated the schema up, otherwise, column information could be
ActiveRecord::Base.descendants.each { |klass| klass.reset_column_information } # outdated. We have a separate method for this so we can override it in EE.
ActiveRecord::Base.descendants.each(&method(:reset_column_information))
# Without that, we get errors because of missing attributes, e.g. # Without that, we get errors because of missing attributes, e.g.
# super: no superclass method `elasticsearch_indexing' for #<ApplicationSetting:0x00007f85628508d8> # super: no superclass method `elasticsearch_indexing' for #<ApplicationSetting:0x00007f85628508d8>
ApplicationSetting.define_attribute_methods ApplicationSetting.define_attribute_methods
end end
def reset_column_information(klass)
klass.reset_column_information
end
def previous_migration def previous_migration
migrations.each_cons(2) do |previous, migration| migrations.each_cons(2) do |previous, migration|
break previous if migration.name == described_class.name break previous if migration.name == described_class.name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment