0

I have params that are coming into the controller looking like this:

      {
        invitee: {
          first_name: first_name,
          last_name: last_name,
          email: email,
          state: state,
        },
        invitor: { sender_uid: sender_uid }
      }

So there are two keys, invitee and invitor and their values are hashes. What's a good way to handle them in the strong params? Would it be useful to add a top level key to this hash so I can use require in the strong params.

1 Answer 1

1

You can just do like below

params.permit(invitee: [:first_name, :last_name, :email, :state], invitor: [:sender_uid]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.