Daniel Harple
3/6/2006 5:27:00 PM
On Mar 6, 2006, at 5:57 PM, Nathan O. wrote:
> This code generates the complaint that "part" is an array, and thus
> cannot be converted to a string. How do I iterate over each item in
> that
> array of address data?
I see no problem with that code, except I would write it as:
%w{addr1 addr2 city state zip country}.each do |part|
puts %{<input type="hidden" name="#{part}" value="#{post[part]}" />}
end
You don't have another local variable named part, do you?
When you convert an array to a string, all the elements just get
mashed together: %w{foo bar baz}.to_s -> "foobarbaz"
-- Daniel