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
或self.owner
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.