Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit has_one field in forms #2664

Open
adrianthedev opened this issue Apr 6, 2024 · 0 comments
Open

Edit has_one field in forms #2664

adrianthedev opened this issue Apr 6, 2024 · 0 comments
Labels
DSL-related Enhancement New feature or request Task Something to get done

Comments

@adrianthedev
Copy link
Collaborator

Feature

There's a common practice to have a User model that has a has_one association with Profile.
Also, there's a common need to be able to edit the profile record on the edit user page.

So we'd like to support that.

Approach

  • we could use accepts_nested_attributes_for because we could offload a lot of functionality on it
  • we need to make sure that the nested fields have their values passed through their own fill_field method before it's passed to the model as a nested attribute
  • we need to render the form for the has_oneon theEdit` view
  • we need to hide the inverse belongs_to association on that form
  • do we need to have a mechanism to hide/sow fields if the resource is nested?

Current workarounds

Using resource tools, but it's a bit cumbersome.

@adrianthedev adrianthedev added Enhancement New feature or request DSL-related Task Something to get done labels Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DSL-related Enhancement New feature or request Task Something to get done
Projects
Status: No status
Development

No branches or pull requests

1 participant