From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.229.248.11 with SMTP id me11cs8263qcb; Thu, 21 Oct 2010 23:32:12 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncCPb0wYycDBDq34TmBBoEAAc30w@googlegroups.com designates 10.151.2.4 as permitted sender) client-ip=10.151.2.4; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncCPb0wYycDBDq34TmBBoEAAc30w@googlegroups.com designates 10.151.2.4 as permitted sender) smtp.mail=rack-devel+bncCPb0wYycDBDq34TmBBoEAAc30w@googlegroups.com; dkim=pass header.i=rack-devel+bncCPb0wYycDBDq34TmBBoEAAc30w@googlegroups.com Received: from mr.google.com ([10.151.2.4]) by 10.151.2.4 with SMTP id e4mr1921292ybi.70.1287729132031 (num_hops = 1); Thu, 21 Oct 2010 23:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received:received-spf:received:mime-version:received :received:in-reply-to:references:date:message-id:subject:from:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=/WRK++6S0tkUto4xzYeHgaOG+qUvbmo776WG8iZ3nsk=; b=16I12yragdCyHtTEek4P5DCU4NP0C233UK37APhpCm9G7B/SYdDXPCH45iN7qeeywE DecXsb/TATi3GCJpqMMiSthgjYodtSMftuVLSsgVgfq1hBbA7HhWLtjICjgJRn3+lGhc kffDXeee+CBvvuXfv1YBUADzRo9INVrOuxPmc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:date :message-id:subject:from:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=mk8/kCm1lNUyRx84RiqZh44dKD5rKNri2s+NkFti/lQobMmqu6VE6dCEjEC0+DB2JV eKIt/SLaHY4yl7JcRfpDpe7epSsBU2/B6d834GG1TR481IL3I2p4eWNEvfvgLSegbJ+7 w6JKvJ7Kh3VzGrv/ZOOTDzBPSfuhQ1R8Ygql0= Received: by 10.151.2.4 with SMTP id e4mr404930ybi.70.1287729130049; Thu, 21 Oct 2010 23:32:10 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.150.53.21 with SMTP id b21ls1762942yba.4.p; Thu, 21 Oct 2010 23:32:09 -0700 (PDT) Received: by 10.150.140.19 with SMTP id n19mr1123491ybd.0.1287729129276; Thu, 21 Oct 2010 23:32:09 -0700 (PDT) Received: by 10.150.50.7 with SMTP id x7mr1096450ybx.52.1287728378074; Thu, 21 Oct 2010 23:19:38 -0700 (PDT) Received: by 10.150.50.7 with SMTP id x7mr1096449ybx.52.1287728378002; Thu, 21 Oct 2010 23:19:38 -0700 (PDT) Received: from mail-gw0-f47.google.com (mail-gw0-f47.google.com [74.125.83.47]) by gmr-mx.google.com with ESMTP id g34si1492992ybc.3.2010.10.21.23.19.36; Thu, 21 Oct 2010 23:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of sylvain.desve@gmail.com designates 74.125.83.47 as permitted sender) client-ip=74.125.83.47; Received: by gwaa11 with SMTP id a11so755145gwa.34 for ; Thu, 21 Oct 2010 23:19:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.91.194 with SMTP id o2mr946544qcm.250.1287728376709; Thu, 21 Oct 2010 23:19:36 -0700 (PDT) Received: by 10.229.184.85 with HTTP; Thu, 21 Oct 2010 23:19:36 -0700 (PDT) In-Reply-To: <9709dac9-9acd-4e4b-b1e6-eaa6e202ae36@37g2000prx.googlegroups.com> References: <9709dac9-9acd-4e4b-b1e6-eaa6e202ae36@37g2000prx.googlegroups.com> Date: Fri, 22 Oct 2010 08:19:36 +0200 Message-ID: Subject: Re: Links and Modular Apps From: =?ISO-8859-1?Q?Sylvain_Desv=E9?= To: rack-devel@googlegroups.com X-Original-Sender: sylvain.desve@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of sylvain.desve@gmail.com designates 74.125.83.47 as permitted sender) smtp.mail=sylvain.desve@gmail.com; dkim=pass (test mode) header.i=@gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: multipart/alternative; boundary=0016364ee64076054304932ea08f --0016364ee64076054304932ea08f Content-Type: text/plain; charset=ISO-8859-1 The Rack URLMap changes the env so that '/app1' is moved from PATH_INFO to SCRIPT_NAME. You need a helper in your Sinatra application to reconstruct paths : helpers do def path_to(path) request.script_name + path en end and then use it in your templates : 2010/10/22 andyl > I would like to use Rack to mount modular apps. > > Using the 'map' statement in config.ru, I can mount an app just fine. > > But - the links in my sub-apps don't work. > > If I mount App1 on '/app1', and App1 has a link , > it needs to render '/app1/page' instead of '/page'. > > How do people get around this problem?? > > Thanks, Andy --0016364ee64076054304932ea08f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The Rack URLMap changes the env so that '/app1' is moved from PATH_= INFO to SCRIPT_NAME.

You need a helper in your Sinatra a= pplication to reconstruct paths :

helpers do
=A0=A0def path_to(path)
=A0=A0 =A0request.script_name + path=
=A0=A0en
end

and then use it in your= templates :

<a href=3D'#{path_to('<= span class=3D"Apple-style-span" style=3D"font-family: arial, sans-serif; fo= nt-size: 13px; border-collapse: collapse; ">/page')}'>

2010/10/22 andy= l <akleak@gmail.co= m>
I would like to use Rack to mount modular apps.

Using the 'map' statement in config.ru, I can mount an app just fine.

But - the links in my sub-apps don't work.

If I mount App1 on '/app1', and App1 has a link <a href=3D'/= page'>,
it needs to render '/app1/page' instead of '/page'.

How do people get around this problem??

Thanks, Andy

--0016364ee64076054304932ea08f--