Nithin Bekal

Posts About Notes Slides


Rails setup

Rails application servers

Rails metrics

Rails Deployment

Rails Internals

Rails and Databases

Rails API applications

Indexing in Rails

  • Always add index for foreign keys
# Bad
create_table(:tweets) do |t|
  t.string  :text
  t.integer :user_id

# OK
create_table(:tweets) do |t|
  t.string  :text
  t.integer :user_id
add_index :posts, :user_id

# Better - automatically adds user_id field and creates index
create_table(:tweets) do |t|
  t.string     :text
  t.references :user

Authentication from scratch

Contributing to Rails

  • Install Virtualbox -
  • Install Vagrant -
  • Clone rails-dev-box -
  • git clone
cd rails-dev-box
vagrant up

This will take a lot of time the first time. A LOT.

git clone

The current directory will be mounted as /vagrant in the vagrant box.

vagrant ssh
cd /vagrant/rails

Get the latest changes from upstream rails:

git remote add rails git://
git fetch rails
git checkout master
git rebase rails/master

git push origin master

bundle exec rake test
  • takes long long time to run