开发者

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?


owner or self.owner.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜