Hello RoR Developers,
I have tiny problem with sorting hash. I can not sort hash values.
i have hash which is created by yaml file.
yaml file
template1:
template_of_roster3: template_of_roster2
template_of_roster4: template_of_roster3
controller:
@get_config=YAML.load(File.open("#{PATH_IM}/.......yml"))
@get_config == Hash
@enterprises==Hash
@my_hash=@get_config["template1"]
and I use this hash in my selection like
view:
<%
templateOptions = ""
@sites.each do |key,value|
templateOptions = templateOptions + "<option
value=#{key}>#{value}</option>"
end
%>
<%=select_tag "templates",
templateOptions,{''style'' =>
''width:100px'' } %>
in fact there is no problem here but when I update my hash like this
@new_hash={"new_hash"=>"new_hash"}
@my_hash.update(@new_hash)
it s sorted like,
new_hash
template_of_roster2
template_of_roster3
but I want to see new_hash at the last option. how can I do it? any
idea.
thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---