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

Support nested forms for has_many relationships

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge nested into master Apr 15, 2016
  • Overview 1
  • Commits 6
  • Pipelines 0
  • Changes 10

Created by: gracewashere

Closes #192 (closed)

Feature:

When I create or edit a model that has_many nested models, I want to view and edit the attributes of the nested models so I can set up all the relationships with a single form.

Implementation:

Introduce a new field type, NestedHasMany.

I considered building the feature into the existing HasMany field, but this would get in the way of HasMany relationships that aren't directly nested, such as in many-to-many relationships.

The NestedHasMany field builds off of the Cocoon gem. It renders fields from the nested model, based on the fields defined in the nested model's dashboard class.

Cocoon provides helpers and javascript to easily add and remove nested form fields from the page.

Preview

nested

Next Steps

  • Needs some design love
  • Needs tests
  • It would be great to have people test this on their own apps and report bugs before we merge
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: nested