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
  • !1176

Support for other types of association fields

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Pablo Brasero requested to merge open-to-other-association-types into master Jun 15, 2018
  • Overview 9
  • Commits 3
  • Pipelines 0
  • Changes 7

After merging https://github.com/thoughtbot/administrate/pull/945, a problem surfaced with plugins that provide new types of association fields, such as https://github.com/pablobm/administrate-field-nested_has_many.

Administrate::BaseDashboard hard-codes the possible types of association fields in a list that is later used to determined the permitted params. This means that new types of fields cannot make permitted params and things break.

My proposed solution (see lib/administrate/base_dashboard.rb) does a programmatic search for field classes that inherit from Administrate::Field::Associative. This allows plugin authors not to worry about adding their new type to a list or any other sort of setup.

A potential problem with this approach is that it includes Administrate::Field::Polymorphic on the list. I don't know if this can cause problems down the line or not.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: open-to-other-association-types