lib/synvert/snippets/rails/strong_parameters.rb in synvert-0.0.8 vs lib/synvert/snippets/rails/strong_parameters.rb in synvert-0.0.9
- old
+ new
@@ -26,10 +26,10 @@
end
within_file 'app/controllers/**/*.rb' do
within_node type: 'class' do
object_name = node.name.source(self).sub('Controller', '').singularize.underscore
- if_exist_node type: 'send', receiver: 'params', message: '[]', arguments: [object_name] do
+ if_exist_node type: 'send', receiver: 'params', message: '[]', arguments: [object_name.to_sym] do
if parameters[object_name]
# append def xxx_params; ...; end
unless_exist_node type: 'def', name: "#{object_name}_params" do
append """def #{object_name}_params
params.require(:#{object_name}).permit(#{parameters[object_name]})