0

イベント (基本的には投稿) と呼ばれるものがありますが、それらにはさまざまな種類 (「種類」) があるため、レイアウトのどこに配置するかを分類するのに役立ちます。とにかく、イベント/編集ページに移動すると、次のエラーが表示されます。

Mysql2::エラー: 'where 句' の不明な列 'event_kinds.event_id': SELECT event_kinds.* FROM event_kinds WHERE event_kinds. event_id= 1 リミット 1

協会の問題かもしれないと思ったのですが、そうですか?

EventKind has_many :events
Event has_one :event_kind

?

編集: event_kinds の名前を kind に変更しました。現在、イベントと種類のモデルをリンクする event_kinds というテーブルはありません。各イベントは 1 つの種類にしかできないため、イベント テーブル内に種類 ID を入れるだけです。events_kind をスキップできる方法はありますか...

4

1 に答える 1

0

You need to add event_id column to the event_kinds table.

Just create a migration

rails g migration add_event_id_to_envent_kind

Edit he file and add the below content.

def change
  add_column :envent_kinds, :event_id, :integer
end

Run migration

rake db:migrate

This should solve the error.

于 2012-09-25T20:39:07.833 に答える