Skip to content

Searching associated: enum field #1080

Open
@killthekitten

Description

@killthekitten

Imagine, that we have got Model with enum field :state and AssociatedModel. When we are trying to attach AssociatedModel to Model from rails_admin interface, the search query fails: it tries to match string and integer.

This bug hides in lib/rails_admin/adapters/active_record.rb within build_statement method:

when :enum
  return if value.blank?
  ["(#{column} IN (?))", Array.wrap(value)]
end

This piece of code generates something like ...state IN ('Search string')
It must return from method in case if value.blank? || value.is_a?(String) or something like that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions