我正在使用Ruby on Rails并尝试从数据库中获取值。如何在使用 Rails 控制台时获取该值?
Stat.where("user_health" < "user_max_health").pluck(:id)
我需要一个工作命令,这个不起作用。
Stat
模型有id
、user_health
和user_max_health
列。
我在开发中使用SQLite,在生产中使用PG,但我需要在两者上工作。
Stat.where('user_health <user_max_health').pluck(:id)>