Rails [已解决] 弱弱的问一下 tinyint 的字段怎么赋值成 2?

raofeng · 2014年12月29日 · 最后由 ericguo 回复于 2014年12月29日 · 1488 次阅读

表不是使用 migrate 建立的,非常感谢。

require 'active_record/connection_adapters/mysql2_adapter'
ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans = false

这样给解决了。加在 Model 里边,或者 application.rb

帅!第一句其实不需要吧?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号