debian-mirror-gitlab/app/helpers/safe_params_helper.rb

14 lines
372 B
Ruby
Raw Normal View History

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!)
2020-10-04 03:57:07 +05:30
params.except(*ActionDispatch::Routing::RouteSet::RESERVED_OPTIONS).permit!
2018-06-27 16:04:02 +05:30
else
params
end
end
end