librelist archives

« back to archive

Routing patterns for Rails static routes

Routing patterns for Rails static routes

From:
Henry Baragar
Date:
2011-04-06 @ 13:04
Hello,

I googled without success for the mongrel2 routing patterns to serve static 
content for Rails applications.  Could someone please point me to them, so 
that I don't make any errors in setting them up for my application?

Regards,
Henry

-- 
Henry Baragar
Instantiated Software

Re: [mongrel2] Routing patterns for Rails static routes

From:
Zed A. Shaw
Date:
2011-04-08 @ 22:34
On Wed, Apr 06, 2011 at 09:04:50AM -0400, Henry Baragar wrote:
> Hello,
> 
> I googled without success for the mongrel2 routing patterns to serve static 
> content for Rails applications.  Could someone please point me to them, so 
> that I don't make any errors in setting them up for my application?

Yep, assuming you've got things that are static in a /static/ then take
a look at the examples/configs/mongrel2.conf for how to do it.  I use it
on my sites.

Another pattern I use with Tir is to have each major route for the
application be something like /Login or /Person, and then have all
static content be /mypage.html and so on.  Since app routes are always
uppercase and content routes are lowercase, and since Mongrel2 routing
is case-sensitive, you never clash.  Takes more config but it definitely
gives you more flexibility later.

-- 
Zed A. Shaw
http://zedshaw.com/