- Everything in Ruby is an Object (except blocks) and everything has methods.
- In Ruby,
{}
are generally interchangeable with the keywordsdo
andend
. - There is no method overloading, the last one declared is invoked, because it overrides the others.
- Instance variables (attributes) are trapped inside the instance and need to be published throught attribute accessors methods, for instance.
t.integer :int # int (4 bytes, max 2,147,483,647) | |
t.integer :int1, :limit => 1 # tinyint (1 byte, -128 to 127) | |
t.integer :int2, :limit => 2 # smallint (2 bytes, max 32,767) | |
t.integer :int3, :limit => 3 # mediumint (3 bytes, max 8,388,607) | |
t.integer :int4, :limit => 4 # int (4 bytes) | |
t.integer :int5, :limit => 5 # bigint (8 bytes, max 9,223,372,036,854,775,807) | |
t.integer :int8, :limit => 8 # bigint (8 bytes) | |
t.integer :int11, :limit => 11 # int (4 bytes) |
Originally published in June 2008
When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.
To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.
Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.
###This error can appear when you try to install ruby gems follow this steps:
###Error: no such file to load --zlib 1. sudo apt-get install zlib1g zlib1g-dev 2. cd /usr/src/ruby-1.9.2-p180/ext/zlib/ 3. sudo ruby extconf.rb 4. sudo make 5. sudo make install
# Los nombres de las CLASES y MODULOS debe empezar con mayúscula | |
# Se considera buena práctica poner estos nombres en un CamelCaseConMayusculaAlPrincipio | |
module Nameable | |
# El método self.included se llama cuando una clase INCLUYE este módulo | |
# El parámetro 'base' es la CLASE que incluye el método | |
# En este caso es la clase 'Car' y la clase 'User' | |
# NOTA: No existe un hook similar para extend (no existe self.extended(base)). | |
def self.included(base) |