0
こんにちは私はモデルを作成する必要があります。モデル内の1つの列を他のモデルに関連付ける
class CreateLecturers < ActiveRecord::Migration
def change
create_table :lecturers do |t|
t.string :firstname
t.string :lastname
t.string :position
t.string :email
t.timestamps null: false
end
end
end
ここは私の2番目のモデルです。
class CreateCurriculums < ActiveRecord::Migration
def change
create_table :curriculums do |t|
t.string :title
t.integer :hours
t.integer :year
t.text :description
t.timestamps null: false
end
end
end
カリキュラムを講師に移行します。しかし、IDなしで、タイトルは どのようにすることができますか?
だから、私はrails-adminを使います。私はいくつかのカリキュラムを追加するときに私はドロップダウン講師で選びたいと思うし、講師をいくつか追加すると、モデル間のカリキュラムを選択したい。