class PTruck < ApplicationRecord has_many :p_truck_spaces belongs_to :p_driver accepts_nested_attributes_for :p_truck_spaces, allow_destroy: true def name self.marque.to_s + " " + self.immat.to_s end end