简体   繁体   中英

Ruby on Rails hstore query date greater

I am trying to query a hstore value called "date_of_birth" that is inside a column named "physical". The value is a unix time stored as a string.

dob = (Time.now - 18.years.ago)
User.where("(physical ? 'date_of_birth')::int > dob")

My code looks this.

Any help / advice would be greatly appreciated.

User.date_of_birth_before(Time.now-18.years)

这对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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