Skip to content

Support for PostgreSQL ENUM #44

@ledermann

Description

@ledermann

Great gem, @mrkamel!

One small thing: Support for PostgreSQL enums would be great. Currently, it fails with a NameError. Example:

CREATE TYPE public.person_gender AS ENUM (
    'male',
    'female'
);

CREATE TABLE public.people (
    id bigint NOT NULL,
    name character varying,
    gender public.person_gender
);
class Person < ApplicationRecord
  include SearchCop

  enum gender: {
    male: 'male',
    female: 'female'
  }

  search_scope :search do
    attributes :gender, :name
  end
end

Person.search("gender:male")
=> NameError: Uninitialized constant SearchCopGrammar::Attributes::Enum

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions