简体   繁体   English

使用Rails G支架创建后,新表未显示在rails_admin中

[英]New table not displaying in rails_admin after created using rails g scaffold

I'm new to RoR and have only done light scripting and VB, so I'm sorry for the lack of knowledge. 我是RoR的新手,只做过轻脚本和VB,因此对知识的不足感到抱歉。

I have used the Rails_admin gem to add the admin feature to my ruby app. 我已使用Rails_admin gem将管理功能添加到我的ruby应用程序。 I then use rails to generate scaffold. 然后,我使用滑轨生成支架。 Ran rake to bring my db to the latest version. 跑耙使我的数据库到最新版本。 It creates the new table which I can access through http://localhost:3000/phonenumbers , but when I go to the http://localhost:3000/admin only my Users table is displayed. 它创建了一个新表,我可以通过http://localhost:3000/phonenumbers访问该表,但是当我转到http://localhost:3000/admin仅显示我的Users表。 Does rails_admin not automatically recognize all tables in the database? rails_admin不会自动识别数据库中的所有表吗?

Have you tried restarting your server? 您是否尝试过重启服务器?

I experienced a similar problem trying to add a new table, and rails admin on the same table, in one deploy. 我尝试在一个部署中尝试添加新表并在同一表上添加rails admin时遇到类似的问题。 This was because rails admin initializes routes for a table but the migration had not run yet. 这是因为rails admin初始化了表的路由,但是迁移尚未运行。

I had the same issue, I was so focused on my migration that i forgot to add the model. 我遇到了同样的问题,因为我非常专注于迁移,因此忘记添加模型。 You have to restart the rails app so Rails_Admin will pick up the new model. 您必须重新启动Rails应用程序,以便Rails_Admin将选择新模型。 It uses the model to derive the structure not the database. 它使用模型来导出结构而不是数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM