Rails テーブル名 変更
スペルミスによって、テーブル名が意図しないものになっていた。 boradsテーブル => boardsテーブルに変更する。 変更用のマイグレーションを作成。
$ rails g migration change_borads_to_boards
マイグレーションの中身を作成
class ChangeBoradsToBoards < ActiveRecord::Migration[5.2] def change rename_table :borads, :boards end end
モデルの修正
# 修正前 class Borad < ApplicationRecord end # 修正後 class Board< ApplicationRecord end
モデルは単数形なので注意すること!