Tian
Tian

Reputation: 672

Access Active Record Object Attributes in Rails Model

I have a model with the following associations:

class Car < ActiveRecord::Base
  belongs_to :transportation_vehicle
  belongs_to :owner
  has_many :parts

  def scrap(buyer, part)
  ...
  end
end

How would I access owner and parts in the scrap method?

Upvotes: 0

Views: 1172

Answers (1)

Jordan Running
Jordan Running

Reputation: 106097

owner or self.owner.

Upvotes: 1

Related Questions