Commit c7615d4a by Cuong Tran

Merge pull request #347 from brentwalther/fix316

Fix fatal error when using `annotate` with ActiveRecord 4.1
parents b319409c 18eb2d0b
...@@ -321,7 +321,8 @@ module AnnotateModels ...@@ -321,7 +321,8 @@ module AnnotateModels
fk_info = "#\n# Foreign Keys\n#\n" fk_info = "#\n# Foreign Keys\n#\n"
end end
return '' unless klass.connection.supports_foreign_keys? && klass.connection.respond_to?(:foreign_keys) return '' unless klass.connection.respond_to?(:supports_foreign_keys?) &&
klass.connection.supports_foreign_keys? && klass.connection.respond_to?(:foreign_keys)
foreign_keys = klass.connection.foreign_keys(klass.table_name) foreign_keys = klass.connection.foreign_keys(klass.table_name)
return '' if foreign_keys.empty? return '' if foreign_keys.empty?
......
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