rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / code / Atom feed
From: Yehuda Katz <wycats@gmail.com>
To: "rack-devel@googlegroups.com" <rack-devel@googlegroups.com>
Subject: Re: Links and Modular Apps
Date: Fri, 22 Oct 2010 19:29:57 -0700	[thread overview]
Message-ID: <2170183861188701182@unknownmsgid> (raw)
In-Reply-To: <9e9892d7-ff49-4ac5-8246-5b8b8ea89016@a4g2000prm.googlegroups.com>

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 <akleak@gmail.com> 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é <sylvain.de...@gmail.com> wrote:
>> The Rack URLMap changes the env so that '/app1' is moved from PATH_INFO to
>> 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 :
>> <a href='#{path_to('/page')}'>
>> 2010/10/22 andyl <akl...@gmail.com>
>>> 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='/page'>,
>>> it needs to render '/app1/page' instead of '/page'.
>>> How do people get around this problem??
>>> Thanks, Andy

      reply	other threads:[~2010-10-23  2:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22  4:53 Links and Modular Apps andyl
2010-10-22  6:19 ` Sylvain Desvé
2010-10-23  0:13   ` andyl
2010-10-23  2:29     ` Yehuda Katz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2170183861188701182@unknownmsgid \
    --to=rack-devel@googlegroups.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).