Actually, Haml overrides "puts" and uses it to print output to the 
document. "print," however, isn't overridden. Here's how I'd write this:

  def print_address(address)
    puts "#{address.address1}<br/>"
    unless @address.address2.blank?
      puts "#{address.address2}<br/>"
    end
    puts "#{address.city}, #{address.state} #{address.zip_code}"
  end

Note that this is similarly untested.

- Nathan

Steve wrote:
> On Fri, 02 Nov 2007 08:36:40 -0400, Hampton wrote:
>
>   
>> helper:
>>
>> def print_address(address)
>>   print address.address1
>>   puts "<br/>"
>>   unless @address.address2.blank?
>>     print address.address2
>>     puts "<br/>"
>>   end
>>   puts "#{address.city}, #{address.state} #{address.zip_code}"
>> end
>>
>> Thar ya go.
>>
>> -hampton.
>>
>> PS: That's totally untested code that I have just written now at 8:30
>> in the morning without any coffee.
>>     
>
> Isn't the fact that it uses 'puts' going to output it to the terminal as
> well?
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to