Freek van Rijt

Ruby on Rails (crash)course

februari 25, 2010 at 22:58 in Code,English (archived) 1 comment

I spent the past four days on a Ruby on Rails (crash)course – I’d heard of the language before but never really read into it, so I signed up for the course to learn more on the language and see how much of an alternative it is to PHP.

I could write up a really long and boring story about the advantages and disadvantages of Ruby on Rails, but I might as well sum it up like this:

  • First of all, Ruby on Rails is a hassle to install on Windows. It does better on OSX (or Linux for that matter). I had to use an old .dll adapter to get it working with my existing MySQL installation, and WebRick liked to crash on me. A lot. Sadly the mod_rails extension for Apache is not available on Windows.
  • Be prepared to use the console, a lot!
  • Rails’ conventions force you to code properly and neatly, unlike the more free-for-all setup in PHP
  • Rail’s MVC setup is pretty much the same as that found in PHP frameworks like Zend
  • Coding in Rails means you have to allow Rails to do a lot of the work for you. It saves effort, but it might not appeal to the control freak.
  • Rails handles relational databases internally. Relations are defined in rails and forced there, rather then doing so in your database – where you’d otherwise be able to use proper foreign keys and constraints
  • However, using rails it’s a lot easier to find relating objects. Let say we have a variable called @user which has some information on the logged in user. Finding the blogposts made by that user would be as simple as @user.posts
  • Rails is a lot more “human” in its language. Instead of using if ! you can use ‘unless’ for example

I ended up expanding a relatively simple project/task system (not dissimilar of basecamp, which also runs on rails) that was given in the assignments for the course. While I can’t demo it here (my host doesn’t support Rails, like many others, another disadvantage) I’ve posted some screenshots with explanations of their functionality below.

Één reactie op “Ruby on Rails (crash)course”

  1. Floris zegt:

    Ik ga in het weekend er ook ff over bloggen:)

Laat een reactie achter