Reformatted excerpts from Guillaume Quintard's message of 2009-09-26:
> message.recipients.each {
>     |person|
>     if (person.email =~ /a...@site.com/) != nil
>         Person.from_address "Foo  <b...@site.org>"
>     end 
> }

The problem is that #each returns the original array, i.e.
message.recipients. Your Person object is getting constructed and then
forgotten.

Try:

if messages.recipients.any? { |p| p.email =~ /a...@site\.com/ }
  Person.from_address "Foo <b...@site.org>"
end

-- 
William <wmorgan-...@masanjin.net>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to