2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-27 16:04:02 +05:30
|
|
|
module SafeParamsHelper
|
2018-10-15 14:42:47 +05:30
|
|
|
# Rails 5.0 requires to permit `params` if they're used in url helpers.
|
2018-06-27 16:04:02 +05:30
|
|
|
# Use this helper when generating links with `params.merge(...)`
|
|
|
|
def safe_params
|
|
|
|
if params.respond_to?(:permit!)
|
|
|
|
params.except(:host, :port, :protocol).permit!
|
|
|
|
else
|
|
|
|
params
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|