views:

9

answers:

1

I have this in my controller:

@statics = [{'home' => 'about'},
            {'home' => 'termsandconditions'},
            {'home' => 'information'},
            {'news' => 'archives'}]

and in my view:

@statics.each do |controller, action|
  xml.loc url_for(:only_path => false, :controller => controller, :action => action)
  xml.lastmod     w3c_date(Time.now)
  xml.changefreq  "weekly"
  xml.priority    0.8
end

the URLs aren't what I would expect, e.g.

http://localhost:3000/homeinformation

instead of

http://localhost:3000/information

However, I just did this manually, I get the right URL:

url_for(:only_path => false, :controller => 'brownies', :action => 'index') #works!

What am I missing here?

A: 

@statics is an array with one hash entry, so you'll need your each block to take just a single parameter and split it up inside the block.

Chris
Ah, cheers. What I needed was an array of arrays. using hashes wrongly....
Kirschstein