From: Serguei Cambour Date: 2013-07-21T06:51:02+09:00 Subject: ActiveSupport undercore behaviour I tried to use ActiveSupport 'underscore' method to convert some non-conventional to RoR data to be able to update later some attributes as follows: TECHS = {"platform"=>[ {"AssignedName"=>"P1", "ExportPrice"=>"USD", "Id"=>"1", "Delivery"=>"Y", "RegisteredMembers"=>[ {"Name"=>"Admin", "Id"=>"3", "AvailablePosts"=>[ {"Seat"=>"2", "Colour"=>18, }, {"Seat"=>"3", "Colour"=>19, }, {"Seat"=>"4", "Colour"=>181, }, {"Seat"=>"5", "Colour"=>183, } ] } ] } ] } TECHS.each_value do |value| arr = value.map {|k,v| [ActiveSupport::Inflector.underscore(k.to_s), v]} puts "ARR: #{arr.inspect}" end The result is strange even if the values look underscored: ARR: [["{\"assigned_name\"=>\"p1\", \"export_price\"=>\"usd\", \"id\"=>\"1\", \"delivery\"=>\"y\", \"registered_members\"=>[{\"name\"=>\"admin\", \"id\"=>\"3\", \"available_posts\"=>[{\"seat\"=>\"2\", \"colour\"=>18}, {\"seat\"=>\"3\", \"colour\"=>19}, {\"seat\"=>\"4\", \"colour\"=>181}, {\"seat\"=>\"5\", \"colour\"=>183}]}]}", nil]] Why are there some extra quotes and nil in the very end ? Thkx -- Posted via http://www.ruby-forum.com/.