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.
在 Rails 中,您可以:
rails c record = Record.where(name: 'Test Record').first record.destroy
你怎么能在花见做同样的事情?我一直在阅读文档,但我很难了解如何使用 Rails 等控制台命令与数据库对象进行交互。
你可以做
$ hanami c UserRepository.new.users.where(name: "Test Record").delete
当一个类继承自Hanami::Repository
Hanami::Repository
delete(id)– 删除给定id对应的记录
delete(id)
在花见使用delete而不是destroy
delete
destroy