Module: ActionView::Helpers::HashToHiddenFields
- Included in:
- Base
- Defined in:
- lib/action_view/helpers/hash_to_hidden_fields.rb
Instance Method Summary collapse
Instance Method Details
#hash_to_hidden_fields(hash) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/action_view/helpers/hash_to_hidden_fields.rb', line 9 def hash_to_hidden_fields(hash) cleaned_hash = hash.reject { |k, v| v.nil? } pairs = cleaned_hash.to_query.split(Rack::Utils::DEFAULT_SEP) = pairs.map do |pair| key, value = pair.split('=', 2).map { |str| Rack::Utils.unescape(str) } hidden_field_tag(key, value) end .join("\n").html_safe end |