简体   繁体   English

Rails-向我的数据库添加内容的宝石?

[英]Rails - A gem to add stuff to my database?

When I build an API to handle my classes, if I want to add data, I have to make CURL commands through the terminal. 在构建用于处理类的API时,如果要添加数据,则必须通过终端发出CURL命令。 Is there a simple way to do this ? 有没有简单的方法可以做到这一点? So I'm looking for a gem (or other stuff) to handle my database easily, by myself (with no access for the users) 因此,我正在寻找一个宝石(或其他东西)来轻松地自己处理数据库(用户无权访问)

I've already found this : https://github.com/igorkasyanchuk/rails_db But it's only to view content, not to add some. 我已经找到了: https : //github.com/igorkasyanchuk/rails_db但这仅是查看内容,而不是添加一些内容。

Thanks ! 谢谢 !

I would suggest reading the Getting Started Guide (again?) closely as this is one of the central functions of the rails framework. 我建议您仔细阅读《 入门指南》,因为这是Rails框架的核心功能之一。 If you are building an application with rails, you should be able to use the rails generate command to set up scaffolds, models, controllers, etc. And when you set up models, they will be persisted to whichever database you have set up (sqlite by default) when you call save on them. 如果您要使用Rails构建应用程序,则应该能够使用rails generate命令来设置支架,模型,控制器等。当您设置模型时,它们将持久化到您已设置的任何数据库中(sqlite默认情况下),当您致电save时。

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

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