Hi,
I’m just starting with Ruby/Rails, and working through OnLamp’s
“Rolling with etc”. I got the cookbook app working OK, but now I want
to create a little project of my own.
I now realise that the url used to access a controller (say
“HelloWorld” doesn’t include the “cookbook” level. So is there only one
set of controllers for a given Rails server or what? (I’m using
Webrick on XP)
I’m just starting with Ruby/Rails, and working through OnLamp’s
“Rolling with etc”. I got the cookbook app working OK, but now I want
to create a little project of my own.
I now realise that the url used to access a controller (say
“HelloWorld” doesn’t include the “cookbook” level. So is there only one
set of controllers for a given Rails server or what? (I’m using
Webrick on XP)
There are several ways to run multiple Rails apps. Which way you go
depends on a number of factors.
Different ports. You can use -p to tell webrick (or
mongrel) to run on a port other than the default 3000. This is the
easiest way to go during development.
Mapping directories. You can use Apache (or your favorite
alternative) to map a /cookbook/ directory to one Rails app and
/checkbook/ to another. I think mongrel is a bit touchy doing this,
though it may have been fixed in the latest release. This isn’t a good
solution during development, since it requires all your apps to run
behind Apache and that’s annoying to work with.
Mapping subdomains. You can use Apache (etc) to map a subdomain to a
Rails app. For example, cookbook.domain.com is one app, and checkbook.domain.com is another. Again, not a great setup for
development but I’ve had good results deploying this way for production.
If all you’re doing is playing around with Rails, go with (1) for now.
When you’re ready to deploy things, you’ll need to explore options like
(2) and (3).
On Sun, Aug 27, 2006 at 07:55:25AM -0700, JimL wrote:
I now realise that the url used to access a controller (say
“HelloWorld” doesn’t include the “cookbook” level. So is there only one
set of controllers for a given Rails server or what? (I’m using
Webrick on XP)
There is only one set of controllers per application. When running the
default webrick-backed webserver, you can only run one Rails
application,
but that is a limitation of the dinky-toy webserver, not Rails itself.
Matt
–
“I have a cat, so I know that when she digs her very sharp claws into my
chest or stomach it’s really a sign of affection, but I don’t see any
reason
for programming languages to show affection with pain.”
– Erik Naggum, comp.lang.lisp
Josh:
I have a similar situation. I hosted my cookbook and photo album on
a web server using apache. I tested both applications using webbrick
and different ports and both work fine. I converted them to fcgi and
used the root domain linked to index.html in the ~/public_html
directory and pointes to the applications hosted in the root directory
~/cookbook/public and ~/photos/public.
The Robins Nest FX
The Robins Family Cookbook
The Robins Family Photo Album
The only problem I have, so far, is that clicking on a link in the
photo album list rdirects back to the root url. (http:// therobinsnestfx.com/?album_id=74). My ~/public_html/.htaccess looks
like this: