Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 rubymine 中使用脚手架创建了一个类并进行了 db 迁移。现在我需要在同一个类中再添加一个实例变量(db 中的表中的一列)。如何在不破坏类的情况下使用 rubymine(不是从命令行)执行此操作?
我不认为我理解这里的真正问题。
您是否不只是回滚当前迁移修改db/migrate(N) 中的迁移并添加所需的列,然后更新模型的视图(因为您使用了脚手架)?一旦你这样做,你将再次迁移。要么,要么您创建一个新的迁移来添加您想要的列 - 但是,鉴于您显然刚刚启动了这个应用程序,我认为没有理由仅仅为此添加额外的迁移。
db/migrate