Rails database boolean values

前端 未结 1 762
春和景丽
春和景丽 2021-01-01 20:46

Code first:

create_table :users do |t|
  ...
  t.boolean :is_active, :default => true
  ...
end

Now, here is my issue - I am creating a

相关标签:
1条回答
  • 2021-01-01 21:14

    I believe that you might be looking for ActiveRecord::Base.connection.quoted_true

    This returns native boolean values in quotes, e.g. '1' for SQL Server or MySQL, and 't' for PostgreSQL or SQLite

    0 讨论(0)
提交回复
热议问题