Hi all!

I have a problem with this function, which should return a formatted
string of an hash given as an argument:

  def show_params(params, tabs_num)
    params_str = String.new if tabs_num == -1
    tabs_num++
    params.each do |key, value|
      tabs_num.times { params_str += "\t" }
      if params.class != value.class
        params_str += "#{key} => " + value.to_s + "\n"
      else
        params_str += "#{key} => \n"
        show_params(value, tabs_num)
      end
    end
    return params_str
  end

I call the function with this:
  show_params(params, -1)

obtaining thish error (in Rails):

  undefined method `+@' for {"action"=>"edit", "id"=>"51",
"controller"=>"items"}:HashWithIndifferentAccess

I cannot guess the reason! Any idea?

Thanks!
-- 
Posted via http://www.ruby-forum.com/.