2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-04-08 00:35:30 -04:00
|
|
|
module SafeParamsHelper
|
2018-04-08 01:27:27 -04:00
|
|
|
# Rails 5.0 requires to permit `params` if they're used in url helpers.
|
|
|
|
# Use this helper when generating links with `params.merge(...)`
|
2018-04-08 00:35:30 -04:00
|
|
|
def safe_params
|
|
|
|
if params.respond_to?(:permit!)
|
|
|
|
params.except(:host, :port, :protocol).permit!
|
|
|
|
else
|
|
|
|
params
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|