ruby on rails - Looping hash but showing the entire set in last loop -
i have following code in rails 3.2: changeset: <%= @version.changeset %><br><br> length: <%= @version.changeset.length %><br><br> <%= @version.changeset.each_with_index |(key, value), i| %> <%= %> - <%= key %> - <%= value %><br> <% end %> output is: changeset: {"getting_there"=>["a", "b"], "description"=>["c", "d"]} length: 2 0 - getting_there - ["a", "b"] 1 - description - ["c", "d"] {"getting_there"=>["a", "b"], "description"=>["c", "d"]} i have no idea why last {"getting_there"=>["a", "b"], "description"=>["c", "d"]} showing. shouldn't shown. instead of: <%= @version.changeset.each_with_index |(key, value), i| %> you need have: <% @...