Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !322

Add search support for ActiveRecord::Enum columns

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/latortuga/enum-search into master Dec 11, 2015
  • Overview 7
  • Commits 5
  • Pipelines 0
  • Changes 16

Created by: latortuga

Bit of a work in progress/hack. Map all searchable fields into a hash and allow each field class to customize the search predicate and comparison term based on the passed search string. If no matching enum value is found in the search term (based on == compare), omit enum field from search string. Otherwise, try to map it to the correct integer value.

I think this needs a new class of some kind, perhaps something like SearchField, instantiated by either the Field class itself or the Deferred class which would avoid having to have the ugly class methods on the fields and the arity difference for enums only. I'm seriously open to design feedback on this one because, while It Works™️, it's not exactly nice looking right now.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/latortuga/enum-search