No I have tried that. It gives me just this output #
[email protected] wrote:
No I have tried that. It gives me just this output #
That’s because the <%= %> construct outputs the return value of the
expression inside it. The .each method actually returns the object it’s
called on - which in this case would be @student.addresses, which isn’t
a string… Try:
"} %>
Alex Y. wrote:
[email protected] wrote:
No I have tried that. It gives me just this output #
That’s because the <%= %> construct outputs the return value of the
expression inside it. The .each method actually returns the object it’s
called on - which in this case would be @student.addresses, which isn’t
a string… Try:<%= @student.addresses.inject{|s, address| s + "Address: #{address.addr1}
"} %>
Oops… That should probably be
"} %>