So, I have a Group object that has child conditions. The Condition object also has a self-referential child association for conditions:
Group has_many :conditions
Condition belongs_to :group has_many :conditions
Is there a nice way to specify the multiple levels in strong params that doesn't require listing them out explicitly for each level (there can be several levels, etc)?
@group_params ||= params.fetch(:group, {}).permit(
:name, conditions_attributes: [
:id, :operator, :value, :_destroy, conditions_attributes: [
:id, :operator, :value, :_destroy, conditions_attributes: ['etc']
]
]
)