I’m hoping to be at the Django and Rails meetup for a few hours tonight. I’ve begun working in Rails on something, well, moderately big and moderately complicated, but I’ve been greatly enjoying the experience. If you’re there too, do say hi; it’d be good to chat. You might even be able to help me with my login controller…
Fun with Ruby
19 August 2005
Gosh, I’ve been busy. Still, in between evenings out and work, I’ve been starting work on a fairly large personal project, which (unless I encounter a colossal brick wall) be written in Ruby, with the Rails framework playing a large part. So far, despite some hiccups, it’s been very pleasant; a fair amount of headscratching (in part down to my unfamiliarity with the langauge and its at-times-bonkers syntax, and in part down to working out just what I wanted to do), but every breakthrough has been delightful. A bit of trial-and-error, and then, suddenly, boom: I’ve got a whole new piece of functionality working with minimal code. I’m enjoying the langauge a lot – it’s reminding me of what I’d learned of Python a fair bit, but with some interesting twists. Particularly a fan of the idea that it’s a language that’s very understandable when spoken aloud, to the point of suggesting that methods with boolean outcomes should end in a questionmark, and that destructive methods should end with an exclamation mark. That’s fun.
More on this mystery project later, perhaps; I’m hoping it could be moderately big.
Haha! I solved the problem in the previous post with some cunning. And Google.
Basically, even though it looks like the mysql
gem has installed correctly, it won’t have, because, once you’ve upgraded to Xcode 2.1, gcc
is upgraded to 4.0. If you try and install the gem with gcc 4.0, it breaks. You need to install it with gcc 3.3 as your compiler. Doing this is as easy as typing
sudo gcc_select 3.3
in your terminal window before you run
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Once you’ve done all that, you can then type sudo gcc_select 4.o
to return things to normal.
Phew. Scaffolds now work. That was an exciting little detour.
Bah
07 August 2005
So much for the success with Ruby on Rails detailed in the last post. Everything was going fine until I tried to create a scaffold
. At which point I get a nasty little MySQL error:
Access denied for user ''@'localhost' (using password: NO)
So basically, even though I’ve defined all the database settings correctly in the database.yml
file for the application, it’s trying to connect without a username or password. And as such, quite rightly, is failing. I’ve reinstalled the mysql gem, I’ve tried configuring the database.yml
file to connect as root; none of it works. Bit frustrated – I can’t see that I’ve done anything wrong, but it’s just not working. I’ve also tried users with both old and new password hashes, and that hasn’t helped either. Anyone got any ideas? Anyone? Lazyweb?
Hear the Tiger RoR
07 August 2005
Well, there’s a thing. I managed (with relatively no hassle) to get a local install of Ruby on Rails up and running on my 10.4.0 Powerbook. Quite surprised – given the scattered documentation – that it went so well. For reference, I used these instructions, which worked exactly as specified. I did already have an install of MySQL, but that was dead easy when I did it a few months ago, too.
Update: of course, then I ran into problems. What I discovered is that those instructions are for an install of Tiger with XCode 2.0, which still only has gcc 3.3. I upgraded to XCode 2.1, and gcc upgraded to 4.0 – and there my troubles began. Of course, then I solved them.
Now to get to work in it. I have an application in mind that it would be ideally suitable for; whether or not I can get my head around the language (especially without making my forget the other ones I know) is another matter. If I was a real programmer, I’m sure this wouldn’t be a problem, but alas, I’m not. Ah well.