You'll probably find that get_config.class == Hash
so you can get the values with:
get_config["template"].values
which gives you an Array over which you could iterate with .each
Rob Biedenharn wrote:
can I
template_of_roster.xml
template_of_roster1.xml
template_of_roster2.xml
template_of_roster3.xml
thank you for any help or commend.
You'll probably find that get_config.class == Hash
so you can get the values with:
get_config["template"].values
which gives you an Array over which you could iterate with .each
I wrote something like this
require 'yaml'
get_config=YAML.load(File.open("C:/yotta/config/template.yml"))
This is a boolean expression, it doesn't *do* anything to the get_config object
get_config.class == Hash
You should save this in a variable
get_config["template"].values
get_config.each do |k,v|
puts v.inspect
end
or just do:
puts get_config["template"].values
result
{"templatename1"=>"template_of_roster.xml",
"templatename2"=>"template_of_roster1.xml",
"templatename3"=>"template_of_roster2.xml", "templatename4"=
"template_of_roster3.xml"}
why I can not get only second column. I only want this side.
template_of_roster.xml
template_of_roster1.xml
template_of_roster2.xml
template_of_roster3.xml
how should I change my codes.
thank you very much for your help Rob Biedenharn ..
You're really not having issues with Rails, but with plain old Ruby (and YAML from the standard library, of course).
hmm
how can I convert to string I mean I know to_s but how will I use it
here. I want to assign the values to variable.
I have selection which is taken these values.
<%
templateOptions = ""
@templates.each do |i|
templateOptions = templateOptions + "<option
value=#{i}>#{i}</option>"
end
%>
<%=select_tag "templates", templateOptions %>
hmm
how can I convert to string I mean I know to_s but how will I use it
here. I want to assign the values to variable.
I have selection which is taken these values.
<%
templateOptions = ""
@templates.each do |i|
templateOptions = templateOptions + "<option
value=#{i}>#{i}</option>"
end
%>
<%=select_tag "templates", templateOptions %>