1
2
3
启动 Rails应用程序
从应用程序根目录运行以下命令,启动Ruby Web服务器:
bin/rails s
服务器启动后,会输出以下消息,指示应用程序正在端口 3000
上运行:
=> Booting Puma => Rails 8.0.1 application starting in development => Run `bin/rails server --help` for more startup options Puma starting in single mode... * Puma version: 6.4.3 (ruby 3.2.5-p208) ("The Eagle of Durango") * Min threads: 3 * Max threads: 3 * Environment: development * PID: 66973 * Listening on http://127.0.0.1:3000 * Listening on http://[::1]:3000 * Listening on http://127.0.2.2:3000 * Listening on http://127.0.2.3:3000 Use Ctrl-C to stop
4
查看餐厅数据
在网络浏览器中打开URL http://127.0.2.2:3000/restaurants。该页面显示餐厅列表以及每家餐厅的详细信息:

Rails 提供了一个默认界面,允许您查看、编辑和删除模型。 在下一节中,您可以学习;了解如何使用该界面与MongoDB数据进行交互。
注意
如果运行问题,请在MongoDB Stack Overflow标签 或MongoDB Reddit 社区 寻求帮助。您还可以使用此页面右侧的 Rate this page标签页提交反馈。