ruby on rails - Is it possible to see if there is a parameter whose name matches a given regex? -
i'm speaking of param name, not value. couldn't find on that.
i'd know if there paramater name matches /[a-za-z]+_page/. value not relevant.
is possible?
try following:
params.keys.any? { |key| key.match /[a-za-z]+_page/ }
Comments
Post a Comment