Skip to content

Best practice for creating a record in a nested route #214

Answered by ellmetha
treagod asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! 👋

It really depends on the situation and what you are trying to achieve!

I think the solution involving a board_id schema field would be necessary in situations where the form needs to display a list of boards to select from (with a select input for example). If the board is inferred from the route and can't be selected, then I would opt for a solution that does not involve adding a schema field and that does not involve using a hidden input (since the value of such inputs can technically be overridden by end users). Using Marten::Handlers::Schema instead of Marten::Handlers::RecordCreate could work in this light:

class Boards::Columns::CreateHandler < Marten::Handlers::Schema
  temp…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@treagod
Comment options

treagod Mar 26, 2024
Collaborator Author

@ellmetha
Comment options

Answer selected by treagod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants