Ruby on Rails 控制台与 where( "value" < "value1" )



我正在使用Ruby on Rails并尝试从数据库中获取值。如何在使用 Rails 控制台时获取该值?

Stat.where("user_health" < "user_max_health").pluck(:id)

我需要一个工作命令,这个不起作用。

Stat模型有iduser_healthuser_max_health列。

我在开发中使用SQLite,在生产中使用PG,但我需要在两者上工作。

Stat.where('user_health <user_max_health').pluck(:id)>

相关内容

最新更新