Ramblings About Ruby on Rails
I pretty much spent all of Friday night, Saturday, and Sunday doing Ruby on Rails-related stuff. Finishing the Agile Web Development book, reading Why’s (Poignant) Guide to Ruby, and writing actual code.
First and foremost, let me say hot damn, the Ruby scripting language is elegant. I still do not comprehend all of it (but I’ve got most of it down thanks to Why!), but really. Damn.
@some_fucking_array.each { |input| print "#{input}\n" }
Or…
@user.user_preference.display_name = 'owlMANatt'
if @user.valid?
@user.save
PHP just ain’t got shit on that.
The guide I mentioned above, Why’s, is worth reading even if you don’t want to learn Ruby, by the way. It’s just that good.
Now, I said that I was writing code. What for, you may ask? A new project? Another half-hearted attempt at doing something?
Yup.
I’m hacking together a pet game (I know, I’m Mr. Unpredictable) with Ruby on Rails. I’m calling it freePets for now, in a parody of the never-quite-started-but-still-fucking-impressive freeCritters. The site will include numerous jabs at Eurleif for his lack of progress despite having been working on freeCritters for something to the order of three fucking years. As a bonus, freePets will be done before freeCritters.
I spent some of yesterday and all of today working on the register screen. Why did it take so long if Ruby on Rails rocks so much? I’m just a tool, that’s all. I’m getting the hang of this Ruby thing, so I should start humming along shortly.
But, I did not *only* write a register script, oh no! I wrote a wonderful unit test to automate the process of testing my register script. It was quick and easy to do, which is why we all love Rails so much!
I did learn about one serious limitation to Rails, however. Rails does not support compound keys. At all. No account number & UUID as a key for me. =(


Leif K-Brooks on 11 Apr 2006 at 9:30 pm #
That’s not elegant, that’s broken.
Does @user.save not do validation on its own? If not, ew. Just… ew. Data integrity should not be up to users. Per-fucking-iod.
If @user.save does perform checks, why are you checking the data yourself? Data checks can be expensive. Call @user.save unconditionally, then catch and deal with the exception (Ruby does have exceptions, right?) raised if the data is invalid.
Max Mills on 12 Apr 2006 at 2:15 pm #
Weren’t _you_ the one in bed with Ruby a year or so ago, Leif? I’m pretty sure I saw numerous RR posts about it on eCritters.
Anyway, I’m learning it aswell, albeit at a very much slower pace, and having problems with item.destroy.. for no reason.
Leif K-Brooks on 12 Apr 2006 at 5:53 pm #
Ruby != Rails.
Max Mills on 13 Apr 2006 at 2:13 pm #
Rails
Max Mills on 13 Apr 2006 at 2:14 pm #
What the..? Did it make the rest of my comment invisible HTML? Rails (appends) Ruby