0

I have a ruby on rails application where I am using SQLite for development and testing, and I am using PostgreSQL in production. How can I write queries that handle booleans in my models that can handle both cases? SQLite handles booleans by using 0 and 1 , and PostgreSQL uses t and f, which is causing my problems.

4

1 回答 1

2

只需使用true/ false。ActiveRecord 将处理其余部分。

例如:Post.where(published: true)

于 2013-10-15T15:28:46.103 回答