Ruby on Rails

Why

Ruby is supposed to be slicker, faster, and easier web-programming than everything else out there. At work, we are hoping that’s true and are building our next-gen product on it. 

Docs

Booster-seat: http://www.amazon.com/Agile-Web-Development-Rails-Third/dp/1934356166/ref=sr_1_1?ie=UTF8&qid=1289238870&sr=8-1

gem command cheat sheet: http://docs.rubygems.org/read/chapter/10.

Editors

I’ll start with Aptana RadRails for 3 primary reasons:

  1. It’s free
  2. It’s part of eclipse and so the editor learning curve isn’t steep.
  3. Upon opening, it prompted for common gems I might like to install

DB connections

The book’s examples use SQLite, but we’re an oracle house. The book does provide a link to oci8 ruby gems for oracle but after reading warnings about building dirvers and having ito install visual C++ to do it, I thought this would be too long of a path to go down. So, I just tried the command:

https://gist.github.com/668076

As you can tell, it ran just fine.

Parenthesis, case-sensitivity, and quotes

You can still use parenthesis in method calls, but they are generally optional. I’m sure this will force me to read ruby code 2 or 3 times before i figure out what it’s doing.

Class names, module names, and constants must start with an uppercase letter. WTF?

Single quotes and double quotes are interpreted differently – for strings in double quotes, you can perform regex like code.

Oh – and not null, nil

Visibility

Methods that have “self.” before it (ex: self.get_id) can be used in the entire application (global).

Methods with “protected” above their declaration can be called by other instances & the same instance of the same class.

Methods with “private” above their declaration can be only called within the same instance of the same class.

Instance variables (those with “@” before them; ex: @id) are not accessible outside the class. You have to write getter/setter methods for them. This is easy in Ruby:

https://gist.github.com/668381

Leave a Reply

Powered by WordPress.com.

Up ↑

%d bloggers like this: