Recommended approach for setting account reference from associated model

Hello,
I'm interested to know what the recommendation is for creating a model and associate it with an account? For example, suppose I have a model like the following.
I'm interested to know what the recommendation is for creating a model and associate it with an account? For example, suppose I have a model like the following.
class JobPhase < ApplicationRecord acts_as_tenant :account belongs_to :account end
I've generated a scaffold for this so that I can create new Job Phases. The _form.html.erb for this just includes a field for the account_id, but I don't think that's safe. I see in other examples that you have set up a helper path, like this for Account Invitations.
<%= form_with(
model:
@account_invitation,
url:
account_account_invitations_path(@account))
do
|form| %>
Is this the recommended approach, or is it wiser to only accept params in the controller for things like attributes on the model, and do something like
phase_attributes = job_phase_params.merge(account_id: Current.account_id) @job_phase = JobPhase.new(job_phase_params)
Thanks for your help!
Notifications
You’re not receiving notifications from this thread.