モデルが同じオブジェクトへのリレーションを設定する場合、
class User < ActiveRecord::Base
  belongs_to :location, :foreign_key => :birth_place
  belongs_to :location
end
以下のコードではViewでuser.locationがアクセスできない・・・
class User < ActiveRecord::Base
  belongs_to :location
  belongs_to :location, :foreign_key => :birth_place
end
 
 
 投稿
投稿
 
 
0 件のコメント:
コメントを投稿