Module: EasyAdmin::ViewHelpers

Defined in:
lib/easy_admin/helpers.rb

Instance Method Summary collapse

Instance Method Details

#clean_params(params) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/easy_admin/helpers.rb', line 3

def clean_params(params)
  if params =~ /\?xml/
    params = Hash.from_xml(params)
  end

  pretty_hash(params)
end

#pretty_hash(hash) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/easy_admin/helpers.rb', line 11

def pretty_hash(hash)
  string = ""
  hash.each_pair do |key, value|
    if value.class == Hash
      value = pretty_hash(value)
      string << "[ #{key.to_s.upcase} ]<br/>"
      string << "#{value}"
    else
      string << "<b>#{key.to_s.titlecase}</b> #{value}<br/>"
    end
  end
  string.html_safe
end