load vs require in Ruby

Another 'note to self'. This time it's about Ruby.

load 'file.rb'

This needs the extension to be supplied, reads the file's content each time it is loaded, no matter how many times it is. And you can load a file from another directory simply by providing a relative or absolute path;

load '../file.rb'
load '/home/deploy/file.rb'

require 'file'

  • No file extension should be supplied
  • Only reads the target files content the first time.