The reason for this is that Ruby on Rails can only find the relationship between two tables automatically if you adhere to certain conventions.
By default, Rails will look for a primary key called "id", and foreign key table connectors called "<tablename>_id". Your database does not adhere to these defaults, therefore Rails cannot automatically find the right connections.
Here's some information on these "magic" field names.
To fix your problem, you need to either modify the database to adhere to the defaults, or explicitly tell Rails the names of the key columns (see
here). For instance:
truck.rb:
class Truck < ActiveRecord::Base
set_primary_key 'OilID'
has_many :oils, :foreign_key => 'vehicleID'
end
oil.rb:
class Oil < ActiveRecord::Base
set_primary_key 'vehicleID'
belongs_to :truck, :foreign_key => 'vehicleID'
end