Skip to content

PG Expression Indexes Produce Undefined Method join for String #377

@bousquet

Description

@bousquet

I have a case-insensitive index on User#username which produces the following index definition:

#<struct ActiveRecord::ConnectionAdapters::IndexDefinition table="users", name="index_users_on_lowercase_username", unique=true, columns="lower((username)::text)", lengths=[], orders=nil, where=nil, type=nil, using=:btree, comment=nil>

Because the #columns attribute of that struct is a String, we get the following errors when annotating our model:

Unable to annotate app/models/user.rb: undefined method `join' for "lower((username)::text)":String
Did you mean?  JSON
Unable to annotate app/models/user.rb: no implicit conversion of nil into Array
Model files unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions