11175
(-- --)
1
least could somebody tell me where is my mistake.
controller
@site_id="id"+current_hierarchy.site_id.to_s
@get_config=YAML.load(File.open("#{PATH_IM}/config/template.yml"))
@get_config == Hash
@merge==Hash
@merge==@get_config[@site_id]
view
<%
templateOptions = ""
@merge.each do |key,value|
templateOptions = templateOptions + "<option
value=#{key}>#{value}</option>"
end
%>
11175
(-- --)
2
ok
this one will be more clear.
I have a template.yml file, like this
template:
templatename1: template_of_roster
templatename2: template_of_roster1
templatename3: template_of_roster2
template1:
templatename1: template_of_roster32
templatename2: template_of_roster143
templatename3: template_of_roster2423
I want to use yaml keys and values in my selection. like,
@get_config=YAML.load(File.open("#{PATH_IM}/config/template.yml"))
@get_config == Hash
<select id="templates">
<option
value="<%=@get_config[template].keys%>"><%=@get_config[template].values%></option>
</select>
this one is not my problem actually, I can do it, my problem is
I have two hashes one is
@hash1==Hash
@hash1=@get_config[template]
other one is
@hash2==Hash
@hash2=@get_config[template1]
I want to merge these two hashes in one and create selection like above.