Ease customization in processes controller
By extracting a method just for the allowed parameters, forks can customize this method by reopening the class.
This commit is contained in:
@@ -41,7 +41,11 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
private
|
private
|
||||||
|
|
||||||
def process_params
|
def process_params
|
||||||
params.require(:legislation_process).permit(
|
params.require(:legislation_process).permit(allowed_params)
|
||||||
|
end
|
||||||
|
|
||||||
|
def allowed_params
|
||||||
|
[
|
||||||
:title,
|
:title,
|
||||||
:summary,
|
:summary,
|
||||||
:description,
|
:description,
|
||||||
@@ -63,9 +67,9 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
:result_publication_enabled,
|
:result_publication_enabled,
|
||||||
:published,
|
:published,
|
||||||
:custom_list,
|
:custom_list,
|
||||||
*translation_params(Legislation::Process),
|
*translation_params(::Legislation::Process),
|
||||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||||
)
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_tag_list
|
def set_tag_list
|
||||||
@@ -74,6 +78,6 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resource
|
def resource
|
||||||
@process || Legislation::Process.find(params[:id])
|
@process || ::Legislation::Process.find(params[:id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user