Home > Rails > Rails2.3.4でbelongs_toのリレーションがうまく動かない。

Rails2.3.4でbelongs_toのリレーションがうまく動かない。

  • 2009-12-10 (木) 23:11
  • Rails

はまりちゅう。

とある事情で、Railsの規約からはみだしてリレーションをはりたい。

Aテーブルで参照したいのは hoge_id でこちらが hasmany :b。

Bテーブルで参照したいのは foo_id で belongs_to :a。

belongs_to :a , :primary_key => foo_id, :foreign_key => hoge_id

これで動かず。。

んーこの辺の理解が全然足りていないみたいだな。

勉強しよう。

今日は遅いのでもうやめですな。

おしまい。

Comments:0

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://www.terut.net/wp-trackback.php?p=186
Listed below are links to weblogs that reference
Rails2.3.4でbelongs_toのリレーションがうまく動かない。 from Action*3

Home > Rails > Rails2.3.4でbelongs_toのリレーションがうまく動かない。

Search
Feeds
Meta
Get Adobe Flash playerPlugin by wpburn.com wordpress themes

Return to page top