Skip to content

Commit 2a977bf

Browse files
ryu39ctran
authored andcommitted
Fix error when table_name is frozen (#517)
1 parent 63cc88c commit 2a977bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/annotate/annotate_models.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ def retrieve_indexes_from_table(klass)
212212
return indexes if indexes.any? || !klass.table_name_prefix
213213

214214
# Try to search the table without prefix
215-
table_name.to_s.slice!(klass.table_name_prefix)
216-
klass.connection.indexes(table_name)
215+
table_name_without_prefix = table_name.to_s.sub(klass.table_name_prefix, '')
216+
klass.connection.indexes(table_name_without_prefix)
217217
end
218218

219219
# Use the column information in an ActiveRecord class

0 commit comments

Comments
 (0)