Welcome, Guest. [ Log In ]
Question   Ruby on Rails
Search KBase

Top 5 in this Area:
1. Do you support FrontPage?
2. Why does my Frontpage email form not work?
3. How do I publish my FrontPage pages to the Internet?
4. Ruby on Rails
5. Online Image Manipulation with ImageMagic

Ruby on Rails
Yes! We do officially support Ruby on Rails with FastCGI now!

Last updated: Jun 28, 2005.

User Post (2005-12-31 00:49:11 by ninesys)
My mistake, it is already there under the "Configuring your site" section. Of course, it is most likely a matter of what is more important. The WiKi get's you started in "QuickStart Guide" but then starts talking about optimizations. Whatever! I want to see the site first! :)
User Post (2005-12-31 00:45:29 by ninesys)
RE: dshafe

I ran across the same problem as you. I followed the http://wiki.dreamhost.com/index.php/Ruby_on_Rails tutorial but realized (when I went to view the site) that I could see the rails folder structure. Here is what I did.

1.) Created the subdomain using the control panel. By default it places the directory in your home folder. It creates the folder "subdomain.yourdomain.com"

2.) Login via SSH and in the home directory run "rails subdomain.yourdomain.com"

This step creates the directory structure necessary for step 4

3.) Login to the control panel again and navigate to https://panel.dreamhost.com/index.cgi?tree=domain.manage&

Once you're there, click on the subdomain's "EDIT"

4.) Change the "Web Directory" setting from "/home/username/subdomain.yourdomain.com" to "/home/username/subdomain.yourdomain.com/public"

5.) Wait 10 minutes

6.) Hit the refresh button at subdomain.yourdomain.com

It's funny that this type of tutorial doesn't appear in the WIKI. Let's see if I can edit it....

User Post (2005-12-15 07:58:48 by machorro)
I'm having problems running rails apps in directories other than root if not using a trailing slash, i.e.:

(doesn't work)


The error I get without the trailing backslash is:

Bad Request
Your browser sent a request that this server could not understand.

I do have the RewriteEngine turned on and the RewriteBase is set to /railsapp. I've also tried it as /railsapp/.

Any ideas? Thanks!
User Post (2005-12-12 23:23:41 by dshafer)
I figured this one out finally.

You really have to create your rails apps at the level above the domain where you want to use them and then create the symbolic link. Somehow I ended up with the depot directory in my domain area and nothing would work. When I blew away that directory and restarted at the level above the domain. I finally got it to work right.

My sense is this stuff wouldn't be so hard on a server I controlled completely. I'm going to try that at some point but right now I think I'm ready to start running with RoR for a project learning curve.
User Post (2005-12-12 14:41:15 by dshafer)
I'm having some trouble getting through the Rails book by Dave Thomas because of routing problems that are apparently related to the somewhat different way MySQL databases are handled and referenced here. I hope someone can help me. This appears to be a Dreamhost-specific problem that the Rails list can't help with.

I have followed the directions in jwatson's post here, setting up the rails app directory above my site directory and then going to my site and setting up a symbolic link to the rails directory. For the toy demo app this worked fine. Then I had to set up a database which I named ds_depot_development because someone else already had a database called depot_development. I set up that database in my domain (as far as I can tell, that's the only way to do so), so I ended up with a database called ds_depot_development and a host name of http://railsdepotdev.mydomain.com. That works fine in the sense that I was able to go into that database and define the first table required. The table is called products. I can access that table just fine via PHPMyAdmin and it is correctly defined.

Then I went into the database.yml file in my domain/depot/config directory and edited it to look like this:

adapter: mysql
database: ds_depot__development
username: username
password: ***********

# Connect on a TCP socket. If omitted, the adapter will connect on the
# domain socket given by socket instead.
host: railsdepotdev.mydomain.com
port: 3306

As the next step in the process, I'm instructed by the book to generate a Rails scaffold for this database by typing

ruby script/generate scaffold Product Admin

That script runs without error and in fact does seem to create the appropriate files, including the HTML files that make up the various views required to support this application.

However, when I attempt to access the scaffolded app I get the error "Recognition failed for depot/admin". Very discouraging. I don't know if this is an indication that Rails is just not accessible to someone who isn't a fairly serious systems-level person who can understand all of the directory stuff and work around issues like this or what.

Anyone got any ideas? Pointers? Advice?
User Post (2005-11-24 17:53:52 by jrpowell1)

I had the same problem. I finally got it to work by doing this.

adapter: mysql
database: lyrics
username: ******
password: *****
socket: /path/to/your/mysql.sock

# Connect on a TCP socket. If omitted, the adapter will connect on the
# domain socket given by socket instead.
host: lyrics.**********.***
port: 3306
User Post (2005-11-23 12:55:06 by peteofun2)
Since Dreamhost doesn't run MySQL locally I have to use the hostname mysql.domain.com. I get a "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' " when running the "ruby script/generate scaffold" command.

Is the problem in my database.yml file?

username: username for mysql.domain.com
password: password for mysql.domain.com
socket: leave it blank?
User Post (2005-09-21 15:43:16 by davidmtz)
In my case, I had to add #!/sr/bin/env ruby to the app's cgi/fcgi/dispatch.rb in the public directory order to get the FastCGI to work. This was an existing application I was developing on another machine using the Webrick server. YMMV.
User Post (2005-08-30 13:30:11 by jwatson)
A much, much easier way to do this (and safer!) is to create your rails app above your site directory (i.e., /home/username/yourrailsapphere rather than /home/username/yoursite.com/yourrailsapp). Then all you have to do is cd to where you want to access your rails app and create a symlink. For example, let's create a rails app named foobar that we want to access from http://yoursite.com/foobar:

[server]$ cd ~
[server]$ rails foobar
[server]$ cd foobar
[server]$ chmod 755 public
[server]$ chmod 755 dispatch*
[server]$ cd ../yoursite.com
[server]$ ln -s ../foobar/public foobar

Now, you should be able to access your rails app at http://yoursite.com/foobar. No .htaccess modifications required (unless you want to switch to fastcgi, of course). This should at least get you working assuming you're not using a sub-domain, etc.
User Post (2005-08-18 03:09:03 by fileexti)
Is it just me or are the servers extremely slugish and unstable in running rails apps? Yes, I am using FastCGI.
User Post (2005-08-02 11:45:12 by dyometry)
using triantos' method, i was able to setup rails, but when i navigate to mysite.net/rails/ it tells me it cannot find index.html. so i go to: mysite.net/rails/index.html and it shows the welcome page.

my RewriteBase is as follow (not sure if it's correct)
RewriteBase /home/myUserName/mysite.net/rails/public/
User Post (2005-07-22 02:21:57 by wossname)
One thing to add to mjhughes' helpful instructions ... In order to improve the performance on RoR, edit the .htaccess file again, and modify the RewriteRule (at the bottom of the block) which rewrites everything to dispatch.cgi, so that it rewrites to dispatch.fcgi instead. ie change from:

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]


RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

and enable FastCGI in you web host's configuration.
User Post (2005-07-09 18:40:33 by triantos)
If you don't want to create a whole separate host, and instead want to use a sub-dir of your primary web site, Do this:

1. Add a mapping to your rails app's "./public" dir in Domains -> Remap Sub-dir
2. In /path/to/rails/app/public/.htaccess, add this line
RewriteBase /web/sub/dir/path
immediately after the line
RewriteEngine On
The /web/sub/dir/path is the dir in your web site that you mapped to your rails app in step 1.
User Post (2005-07-07 01:19:08 by mjhughes)
Installation is very easy.

1. Start in the dreamhost web-panel manage domains and add a new domain to play around in
e.g. rails.yoursite.com

point the webroot to /home/yourname/yoursite.com/public

2. Goto the dreamhost goodies->mysql and add three new databases
yourname_test, yourname_production,yourname_development
add hostnames for these databases
testdb.rails.yoursite.com, productiondb.rails.yoursite.com, developmentdb.rails.yoursite.com

Lots of folks say the beauty of mysql is that you can keep everything organized in one database. But if you have to read these directions, you, like me, likely make mistakes from time to time. Best in my opinion to mitigate losses.

Wait until you receive emails from dreamhost telling you everything is now active (subdomain is critical -- db less so). Dreamhost says it could be a day or two.

To install to yoursite.com/public

rails /home/yourname/rails.yoursite.com
chmod 0755 /home/yourname/rails.yoursite.com/public
chmod 0755 /home/yourname/rails.yoursite.com/dispatch*

that should do it for basic setup. Navigate to http://rails.yoursite.com/ and there is a welcome page with further informations.

The following may/may not be necessary, but might be worth trying if you still don't see anything.

Many sites recommend to change what they call the "She-bang!" line -- the first line of the code in the public/dispatch.rb, public/dispatch.cgi, and public/dispatch.fcgi files to reflect the location of the ruby executable on the dreamhost servers -- the dreamhost server I'm on, Apok has both.

pico /home/yourname/yoursite.com/public/dispatch.rb
(delete first line in file and type the following)

navigate to
http://rails.yoursite.com/ and hopefully you'll see something other than an error message.
if you want to go nuts and create your own instance of RoR for whatever reason (I can't think of a good one at the moment now that dreamhost supports it) the easiest way I've found is to type the following at the shell

curl http://home.leetsoft.com/dropbox/private-ruby/install | sh