<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30 31
08:27 aidalgol joined
08:44 tumdedum joined
10:15 tumdedum joined
10:27 tumdedum joined
12:24 badeball joined
12:24 <badeball> hi! can I mount a sinatra base in another sinatra base at some URL?
13:08 <Rennex> badeball: yes
13:09 <Rennex> badeball: in config.ru, map "/otherpath" do; run OtherApp; end
13:10 <badeball> Rennex: ah, but I would like to have it specified in the application code and have config.ru know nothing about how I have structured it internally
13:11 <badeball> I found that I can class Foo < Sinatra::Base; use Bar; end
13:13 <Rennex> well there are of course many ways to do it, with some pros and cons
13:14 <Rennex> one issue with mounting anything in a sub-path is the path prefix. map() strips it out, and i don't remember what exactly it does (env["PATH_INFO"] for sure, maybe others too), you could check its source
13:14 <Rennex> SCRIPT_NAME probably
13:15 <Rennex> because another issue is that any internal links the sub-app generates, must be aware of the path it's mounted at. Plain paths (like <img src="/pics/foo.jpg">) is never a good idea; use the path() helper for everything and you'll be fine
13:15 <badeball> hmm, I see
13:15 <badeball> okey, thanks for your help!
13:15 <Rennex> np
13:16 <Rennex> badeball: hm actually, i may have defined my own path(x) helper to call uri(x, false), because sinatra doesn't have it by default... :)
18:23 mwlang joined
20:53 blackmesa joined
21:52 aidalgol joined