Commit df9805b2 authored by Toon Claes's avatar Toon Claes

No longer use `*_ce` for params, but also prepending

Also for permitted params use a prepended EE module to define the list
of accepted attributes (calling `super`).
parent 7f12487a
...@@ -182,14 +182,12 @@ Separate CE and EE actions/keywords. For instance for `params.require` in ...@@ -182,14 +182,12 @@ Separate CE and EE actions/keywords. For instance for `params.require` in
```ruby ```ruby
def project_params def project_params
params.require(:project).permit(project_params_ce) params.require(:project).permit(project_params_attributes)
# On EE, this is always:
# params.require(:project).permit(project_params_ce << project_params_ee)
end end
# Always returns an array of symbols, created however best fits the use case. # Always returns an array of symbols, created however best fits the use case.
# It _should_ be sorted alphabetically. # It _should_ be sorted alphabetically.
def project_params_ce def project_params_attributes
%i[ %i[
description description
name name
...@@ -197,8 +195,16 @@ def project_params_ce ...@@ -197,8 +195,16 @@ def project_params_ce
] ]
end end
# (On EE) ```
def project_params_ee
In the `EE::ProjectsController` module:
```ruby
def project_params_attributes
super + project_params_attributes_ee
end
def project_params_attributes_ee
%i[ %i[
approvals_before_merge approvals_before_merge
approver_group_ids approver_group_ids
......
...@@ -82,14 +82,12 @@ Separate CE and EE actions/keywords. For instance for `params.require` in ...@@ -82,14 +82,12 @@ Separate CE and EE actions/keywords. For instance for `params.require` in
```ruby ```ruby
def project_params def project_params
params.require(:project).permit(project_params_ce) params.require(:project).permit(project_params_attributes)
# On EE, this is always:
# params.require(:project).permit(project_params_ce << project_params_ee)
end end
# Always returns an array of symbols, created however best fits the use case. # Always returns an array of symbols, created however best fits the use case.
# It _should_ be sorted alphabetically. # It _should_ be sorted alphabetically.
def project_params_ce def project_params_attributes
%i[ %i[
description description
name name
...@@ -97,8 +95,16 @@ def project_params_ce ...@@ -97,8 +95,16 @@ def project_params_ce
] ]
end end
# (On EE) ```
def project_params_ee
In the `EE::ProjectsController` module:
```ruby
def project_params_attributes
super + project_params_attributes_ee
end
def project_params_attributes_ee
%i[ %i[
approvals_before_merge approvals_before_merge
approver_group_ids approver_group_ids
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment