A Simple example on how to use strong_parameters, but have it be dynamic
Yes, it's easy to do... the only weird part is that the params.permit won't take an array, it wants a list of parameters. So we need to use the ruby syntax where we prepend the array with *
to have that work.
Simple example of the splat.
def do_the_things(a, b, c)
puts "c: #{c}"
puts "b: #{b}"
puts "c: #{c}"
end
do_the_things *[6, 7, 8]
without the *, you'll get a ArgumentError: wrong number of arguments (1 for 3)
error.
Tests included!