Commit f568bf42 by liyijie

feat: 支持相关的工具升级支持extra_permitted_attributes

parent 614b05d5
...@@ -13,6 +13,7 @@ class <%= controller_class_name %>Controller < SimpleController::BaseController ...@@ -13,6 +13,7 @@ class <%= controller_class_name %>Controller < SimpleController::BaseController
def <%= resource_singular %>_params def <%= resource_singular %>_params
params.require(:<%= resource_singular %>).permit( params.require(:<%= resource_singular %>).permit(
*resource_class.try(:extra_permitted_attributes),
<%- attributes_names(mod: :without_json).each do |attribute_name| -%> <%- attributes_names(mod: :without_json).each do |attribute_name| -%>
:<%= attribute_name %>, :<%= attribute_name %>,
<%- end -%> <%- end -%>
......
...@@ -7,6 +7,7 @@ json.extract!( ...@@ -7,6 +7,7 @@ json.extract!(
<%- attributes_names.each do |attribute_name| -%> <%- attributes_names.each do |attribute_name| -%>
:<%= attribute_name %>, :<%= attribute_name %>,
<%- end -%> <%- end -%>
*<%= resource_singular %>.class.try(:extra_permitted_attributes),
) )
<%- else -%> <%- else -%>
json.merge! <%= resource_singular %>.as_json json.merge! <%= resource_singular %>.as_json
......
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