Hi,
I’ve got a problem I’m working with. I would like to do this:
Here are my proxy pages:
data.states.states.each do |state, entries|
proxy "/states/#{state['name'].downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.html", "/states/template.html", :locals => { :state => state, :statename => state.name }, :ignore => true
end
Yaml file has a list of states
states:
- name: Michigan
country_id: '49'
abbr: MI
- name: South Dakota
country_id: '49'
abbr: SD
- name: Washington
country_id: '49'
abbr: WA
- name: Wisconsin
country_id: '49'
abbr: WI
I then have another folder inside the data directory called entires. I have a file for entires per state like so (ie california.yaml, etc)
-
category: "Test"
name: "Test"
full_address: "Test"
address: "Testt"
city: "Tulare"
state: "CA"
zipcode: "93274"
country: "United States"
phone: "999"
-
category: "Test"
name: "Test"
full_address: "Test"
address: "Testt"
city: "Tulare"
state: "CA"
zipcode: "93274"
country: "United States"
phone: "999"
I’d like to loop through those entries on each of dynamically generated pages. Something like this:
<% data.entries.state.each do |f| %>
do stuff here
<%end>
Thats the part I’m having some difficulty with. Anyone have any advice?