Possible to alias a belongs_to association in Rails?

前端 未结 4 1648
情书的邮戳
情书的邮戳 2020-12-25 10:18

I have a model with a belongs_to association:

class Car < ActiveRecord::Base
  belongs_to :vendor
end

So I can call c

4条回答
  •  甜味超标
    2020-12-25 10:29

    In Rails 4, you should simply be able to add alias_attribute :company, :vendor to your model.

提交回复
热议问题