Use Proc to infer available type attribute visibility

Otherwise, migrations will break when a plugin tries to register new
params.
pull/4322/head
Oliver Günther 9 years ago
parent 02ff24b3b2
commit b64aa048eb
  1. 11
      app/models/permitted_params.rb

@ -215,8 +215,9 @@ class PermittedParams
end end
end end
def type def type(args = {})
params.require(:type).permit(*self.class.permitted_attributes[:type]) permitted = permitted_attributes(:type, args)
params.require(:type).permit(*permitted)
end end
def type_move def type_move
@ -611,10 +612,12 @@ class PermittedParams
:is_milestone, :is_milestone,
:is_default, :is_default,
:color_id, :color_id,
Proc.new do |args|
{ attribute_visibility: ::TypesHelper.work_package_form_attributes.keys }
end,
project_ids: [], project_ids: [],
custom_field_ids: [], custom_field_ids: [],
attribute_visibility: ],
::TypesHelper.work_package_form_attributes.keys],
user: [ user: [
:firstname, :firstname,
:lastname, :lastname,

Loading…
Cancel
Save