From: Mariano Kamp Date: 2006-05-23T21:18:18+09:00 Subject: Does TMail support nested multipart messages? ------=_Part_2424_28651074.1148386694161 Content-Type: multipart/alternative; boundary="----=_Part_2425_32518286.1148386694161" ------=_Part_2425_32518286.1148386694161 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, does anybody know if TMail supports multipart messages? I am using TMail at the moment, but it doesn't seem to work for me. Maybe I am doing something wrong here? I attached the sample and below is the code. The output looks like this: body=3D!Hi, I have the following code: @conversation_pages, @conversations =3D paginate(:conversations, :per_page =3D> 20, :joins =3D> 'LEFT JOIN messages on messages.conversation_id =3D conversations.id '+ 'LEFT JOIN email_addresses on email_addresses.id =3D messages.email_address_id', :conditions =3D> ['email_addresses.emai_______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails ! So the message is broken off at some point, arbitrary to me. Cheers, Mariano require File.dirname(__FILE__) + '/../test_helper' class TMailTest < Test::Unit::TestCase def test_multiparts assert raw =3D File.read("sample") assert mail =3D TMail::Mail.parse(raw) puts "body=3D!#{body_as_plain_text(mail)}!" end def body_as_plain_text(part) body =3D '' if part.multipart? part.parts.each do |subpart| if subpart.content_type =3D=3D 'text/plain' and subpart.content_disposition =3D=3D 'inline' body << subpart.body elsif subpart.content_type =3D~ /^multipart/ body << body_as_plain_text(subpart) end end else body =3D part.body end body end end ------=_Part_2425_32518286.1148386694161 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,

  does anybody know if TMail supports multipart messages?
  I am using TMail at the moment, but it doesn't seem to work fo= r me. Maybe I am doing something wrong here?

  I attached the s= ample and below is the code. The output looks like this:

body=3D!Hi,

   I have the following code:
 = ;        @conversation_pages,
 &= nbsp;        @conversations =3D paginate= (:conversations,
         &= nbsp;           &nbs= p;            &= nbsp; :per_page =3D> 20,
       &n= bsp;            = ;            &n= bsp;   :joins =3D> 'LEFT JOIN messages on
messages.conversation_id =3D conver= sations.id '+
         =             &nb= sp;            =             'LEFT JO= IN email_addresses on
email_addresses.id =3D messages.email_address_id',=
            &nb= sp;            =            :conditions = =3D> ['email_addresses.emai_____________________________________________= __
Rails mailing list
= Rails@lists.rubyonrails.org
htt= p://lists.rubyonrails.org/mailman/listinfo/rails

!

 = So the message is broken off at some point, arbitrary to me.
Cheers,Mariano

require File.dirname(__FILE__) + '/../test_helper'

class TMa= ilTest < Test::Unit::TestCase

  def test_multiparts
 = ;   assert raw =3D File.read("sample")  
 =    assert mail =3D TMail::Mail.parse (raw)
    puts "body=3D!#{body_as_plain_text(mail)}!= "
  end
 
  def body_as_plain_text(part)
&= nbsp;   body =3D ''
    if part.multipart?
&= nbsp;     part.parts.each do |subpart|
  &= nbsp;     if subpart.content_type =3D=3D 'text/plain' and subpart.content_disposition =3D=3D 'inline'
&nb= sp;         body << subpart.b= ody
        elsif subpart.content_typ= e =3D~ /^multipart/
        &nbs= p; body << body_as_plain_text(subpart)
    &nb= sp;   end
      end
    else
 =      body =3D part.body
    end
&n= bsp;   body
  end
end ------=_Part_2425_32518286.1148386694161-- ------=_Part_2424_28651074.1148386694161 Content-Type: application/octet-stream; name=sample Content-Transfer-Encoding: 7bit X-Attachment-Id: f_enk7lpzk Content-Disposition: attachment; filename="sample" X-Apparently-To: onairam0@yahoo.de via 217.12.10.138; Fri, 19 May 2006 07:56:00 -0700 X-Originating-IP: [70.84.143.100] Authentication-Results: mta217.mail.re4.yahoo.com from=lists.rubyonrails.org; domainkeys=fail (bad syntax) Received: from 70.84.143.100 (EHLO wrath.rubyonrails.com) (70.84.143.100) by mta217.mail.re4.yahoo.com with SMTP; Fri, 19 May 2006 07:55:49 -0700 Received: from 6d.8f.5446.static.theplanet.com (localhost.rubyonrails.org [127.0.0.1]) by wrath.rubyonrails.com (Postfix) with ESMTP id 8921F3B1CD; Fri, 19 May 2006 14:55:22 +0000 (GMT) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by wrath.rubyonrails.com (Postfix) with ESMTP id CA77539D4A for ; Fri, 19 May 2006 14:55:10 +0000 (GMT) Received: by py-out-1112.google.com with SMTP id w49so799144pyg for ; Fri, 19 May 2006 07:55:10 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=AOQZOjy0ZI9GWMOAX8ED10a2f4mN8STv2Wu3NnD6C87tfITYIsTQZlQMk//cn/jo2tzViUzrUO+l8eImUPjuevKFxuqjzxXu2pGeXvmhx0lGhHWi77dyWS0Ly8TJIibX7HEYL6EJBGaFnMY70PN2xtmLRKjARA6UdUsbAHBX4Kc= Received: by 10.35.109.2 with SMTP id l2mr2133463pym; Fri, 19 May 2006 07:55:09 -0700 (PDT) Received: by 10.35.67.5 with HTTP; Fri, 19 May 2006 07:55:09 -0700 (PDT) Message-ID: <910a6fc10605190755v4e8a0b3dq66cfd2df99746f5e@mail.gmail.com> Date: Fri, 19 May 2006 16:55:09 +0200 From: "Mariano Kamp" To: rails@lists.rubyonrails.org MIME-Version: 1.0 Subject: [Rails] Problem with joins and overlapping field names X-BeenThere: rails@lists.rubyonrails.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rails@lists.rubyonrails.org List-Id: rails.lists.rubyonrails.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0196854335==" Sender: rails-bounces@lists.rubyonrails.org Errors-To: rails-bounces@lists.rubyonrails.org --===============0196854335== Content-Type: multipart/alternative; boundary="----=_Part_27495_9198801.1148050509716" ------=_Part_27495_9198801.1148050509716 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I have the following code: @conversation_pages, @conversations =3D paginate(:conversations, :per_page =3D> 20, :joins =3D> 'LEFT JOIN messages on messages.conversation_id =3D conversations.id '+ 'LEFT JOIN email_addresses on email_addresses.id =3D messages.email_address_id', :conditions =3D> ['email_addresses.emai= l =3D ?', @email_address.email]) producing this sql staement: SELECT * FROM conversations LEFT JOIN messages on messages.conversation_id = =3D conversations.id LEFT JOIN email_addresses on email_addresses.id =3D messages.email_address_id WHERE (email_addresses.email =3D 'xyz@gmail.com') LIMIT 0, 20 The funny thing is that my conversation.id is no longer referencing the conversation.id but email_addresses.id. I assume this is due to the fact that "*" is generated in the sql, isn't it? I haven't found a way to instruct active record to use explicit column names like conversations.id, email_addressesses.id etc. etc. Any idea how to work around that problem? Cheers, Mariano ------=_Part_27495_9198801.1148050509716 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,

   I have the following code:
   &nb= sp;     @conversation_pages,
   &nbs= p;      @conversations =3D paginate(:conversations= ,
           &nb= sp;            =             :per_pag= e =3D> 20,
         &nbs= p;            &= nbsp;           &nbs= p; :joins =3D> 'LEFT JOIN messages on=20 messages.conversation_id =3D conversati= ons.id '+
         &nbs= p;            &= nbsp;           &nbs= p;           'LEFT JOIN e= mail_addresses on email_addresses.id =3D messages.email_address_id',
&nb= sp;            =             &nb= sp;          :conditions =3D&g= t; ['email_addresses.email =3D ?', @email_address.email])=20

  producing this sql staement:

SELECT * FROM conversati= ons LEFT JOIN messages on messages.conversation_id =3D conversations.id LEFT JOIN email_addresses on email_add= resses.id =3D=20 messages.email_address_id WHERE (email_addresses.email =3D 'xyz@gmail.com') LIMIT 0, 20

  The funny t= hing is that my conversation.id is n= o longer referencing the=20 conversation.id but email_addresses.= id. I assume this is due to the fact that "*" is generated in the= sql, isn't it? I haven't found a way to instruct active record to use expl= icit column names like=20 conversations.id, email_addressesse= s.id etc. etc.

  Any idea how to work around that problem?
=
Cheers,
Mariano
------=_Part_27495_9198801.1148050509716-- --===============0196854335== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails --===============0196854335==-- ------=_Part_2424_28651074.1148386694161--