First a short diversion to put you in the right mood.
An old man, a boy and a donkey were going to town. The boy rode on the donkey and the old man walked. As they went along they passed some people who remarked it was a shame the old man was walking and the boy was riding.
The man and boy thought maybe the critics were right, so they changed positions.
Later, they passed some people that remarked, "What a shame, he makes that little boy walk."
They then decided they both would walk! Soon they passed some more people who thought they were stupid to walk when they had a decent donkey to ride. So, they both rode the donkey.
Now they passed some people that shamed them by saying how awful to put such a load on a poor donkey.
The boy and man said they were probably right, so they decide to carry the donkey. As they crossed the bridge, they lost their grip on the animal and he fell into the river and drowned.
The moral of the story?
If you try to please everyone, you might as well...
Kiss your ass goodbye.
The first job is to bludgeon MySQL into submission (this is always how it feels to me to work with MySQL). I put together a quick schema, create a database, and import the csv into it. The import is lightning fast, so now I have a database loaded with cool stuff. I try to make a user with only select privileges granted, but this just does not work, so I give up on that for now and press on into setting up a rails application.
I hook this up live right away. I suppose more sensible souls would screw around with webrick and delay deployment till the end, but I do just the opposite, set this thing up right away to run in the real world. I edit my apache and lighttpd configuration, set up a virtual host and the proxy setup (as a duplicate of a happily running rails application), and restart both servers (lighttpd runs on port 8080 and apache uses mod_proxy to hand off requests for that virtual host).
Following the scheme in the rails book, I do this:
cd /u1/rails rails micros cd /u1/rails/micros/config vi database.yml cd /u1/rails/micros ruby script/generate scaffold Mount DisplaySo far this just gives me a 404 error. I try stopping lighttpd and then I get a service unavailable error, so I know the proxy setup is doing the handoff. I start lighttpd again and poke around a bit. I find that I have the document root set up to be /www/rails/micros, but I need a symbolic link from there to /u1/rails/micros. After adding that, I get the rails greeting page, and know that I need to setup some kind of routing.
Note that I have the following (among other things):
app/models/mount.rb app/views/display.rb app/controllers/display_controller.rb
Now, I get rid of public/index.html and add a line to config/routes.rb to try to make the "root" path be display/list:
map.connect '', :controller => "display", :action => 'list'When I point my browser at the site, I just get 500 errors. Time to look at the server error log, which is NOT in /var/log/lighttpd. As specified in lighttpd.conf, it is in /u1/rails/micros/log/server.log
Aha, there is some trouble with permissions with something in /u1/rails/micros/tmp.
(And, as a matter of fact, there was some such trouble with /u1/rails/micros/log.
Do this:
cd /u1/rails chmod 777 log chmod -R 777 tmpNow we are off to the races, and the scaffold is showing the first few records in the database.
Ruby on Rails notes / [email protected]