From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.229.248.11 with SMTP id me11cs2941qcb; Fri, 22 Oct 2010 19:31:00 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncCP7CjYe8CRDhkYnmBBoEWI4HQQ@googlegroups.com designates 10.142.2.25 as permitted sender) client-ip=10.142.2.25; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncCP7CjYe8CRDhkYnmBBoEWI4HQQ@googlegroups.com designates 10.142.2.25 as permitted sender) smtp.mail=rack-devel+bncCP7CjYe8CRDhkYnmBBoEWI4HQQ@googlegroups.com; dkim=pass header.i=rack-devel+bncCP7CjYe8CRDhkYnmBBoEWI4HQQ@googlegroups.com Received: from mr.google.com ([10.142.2.25]) by 10.142.2.25 with SMTP id 25mr1010350wfb.60.1287801058853 (num_hops = 1); Fri, 22 Oct 2010 19:30:58 -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-spf:received:received:references:from:in-reply-to :mime-version:date:message-id:subject: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:content-transfer-encoding; bh=lAhrTVpXgEqMz/QwUlYTbdU2VTDIKicagR/4ZYocvcg=; b=pfuHB5tufQf1UtsjwESIQIJnfKBb1qwnd+vvvKCq8gTETUkcDhXR95vWW1JDsXsj+L UicnvqUBHfYhG19Qr/fh+CJDPIt/mkjsVA0uhX/yNXeYvlU92plPwycWNEIMaxzqIe7Y +FUA2WPwCyfIn9802T6EbzqptoPUC2H69Ao2U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:references:from:in-reply-to:mime-version :date:message-id:subject: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:content-transfer-encoding; b=Y7vo/2Q0MWIPsjAA3NOrYnzDrgdQ2yrL5/YT3epCvjK5lJwp/3Xki93KY6/HKr3LgF mfo1kPf7WOtRHtHqznkePmzJtjfOk5ia9QAEroklTtTul3W+TDywxNqy4pPdgbdv8ylC meic79cYtvdLeKFostDzVjokfbKhrOZW75Gb0= Received: by 10.142.2.25 with SMTP id 25mr213501wfb.60.1287801057305; Fri, 22 Oct 2010 19:30:57 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.142.6.9 with SMTP id 9ls5353723wff.3.p; Fri, 22 Oct 2010 19:30:35 -0700 (PDT) Received: by 10.142.210.2 with SMTP id i2mr1025622wfg.45.1287801035469; Fri, 22 Oct 2010 19:30:35 -0700 (PDT) Received: by 10.142.210.2 with SMTP id i2mr1025621wfg.45.1287801035438; Fri, 22 Oct 2010 19:30:35 -0700 (PDT) Received: from mail-px0-f181.google.com (mail-px0-f181.google.com [209.85.212.181]) by gmr-mx.google.com with ESMTP id s21si8284496wff.4.2010.10.22.19.30.34; Fri, 22 Oct 2010 19:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of wycats@gmail.com designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; Received: by pxi3 with SMTP id 3so263021pxi.40 for ; Fri, 22 Oct 2010 19:30:34 -0700 (PDT) Received: by 10.143.43.12 with SMTP id v12mr2912572wfj.344.1287801013258; Fri, 22 Oct 2010 19:30:13 -0700 (PDT) References: <9709dac9-9acd-4e4b-b1e6-eaa6e202ae36@37g2000prx.googlegroups.com> <9e9892d7-ff49-4ac5-8246-5b8b8ea89016@a4g2000prm.googlegroups.com> From: Yehuda Katz In-Reply-To: <9e9892d7-ff49-4ac5-8246-5b8b8ea89016@a4g2000prm.googlegroups.com> Mime-Version: 1.0 (iPhone Mail 8A306) Date: Fri, 22 Oct 2010 19:29:57 -0700 Message-ID: <2170183861188701182@unknownmsgid> Subject: Re: Links and Modular Apps To: "rack-devel@googlegroups.com" X-Original-Sender: wycats@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of wycats@gmail.com designates 209.85.212.181 as permitted sender) smtp.mail=wycats@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: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable this is something that Rails 3.1's engines do automatically (and rails itself will do if you mount the main Rails app in a URLMap). In my opinion, this makes more sense as a Sinatra helper than an output modifying middleware (which is extremely expensive and potentially error-prone) Sent from my iPhone On Oct 22, 2010, at 5:13 PM, andyl wrote: > Thanks - your approach worked !! > > I think I'm going to create a link-rewriting middleware, so I can use > unmodified Sinatra apps - but this is a nice intermediate step. > > - Andy > > On Oct 21, 11:19 pm, Sylvain Desv=E9 wrote: >> 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 >> >>