2016-12-10から1日間の記事一覧
has_many throughでUserモデル、communities_usersモデル、Communityモデルがあった場合 中間モデルに Belongs_to :user Belongs_to :community と書いた場合と Belongs_to :user_id, class_name: "User" Belongs_to :community_id, class_name: "Community"…
データベースのリレーションが苦手です。吉田です。 railsのアソシエーションで軽くハマったのが解決したので、メモ。 今回の原因は命名規則が間違っていてエラーが起こりました。 作りたかったのは、ユーザーはたくさんのコミュニティを持っていて、コミュ…