我该如何关闭TINYINT布尔仿真中的Rails 3.2.2? [英] How do I turn off tinyint boolean emulation in Rails 3.2.2?

查看:198
本文介绍了我该如何关闭TINYINT布尔仿真中的Rails 3.2.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据API文档:

如果您希望禁用此仿真(这是在版本0.13.1的默认行为和更早的版本),你可以添加以下行到您的application.rb中的文件:

 的ActiveRecord :: ConnectionAdapters :: mysql的[2] Adapter.emulate_booleans = FALSE
 

但是,当我这样做,我得到的:

 未初始化的常量的ActiveRecord :: ConnectionAdapters :: Mysql2Adapter
 

解决方案

本文档不要求你需要的ActiveRecord的application.rb中。要求它解决了这个问题。

As per the api docs:

If you wish to disable this emulation (which was the default behavior in versions 0.13.1 and earlier) you can add the following line to your application.rb file:

ActiveRecord::ConnectionAdapters::Mysql[2]Adapter.emulate_booleans = false

But when I do so, I get:

uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Adapter

解决方案

The docs don't ask you to require activerecord in application.rb. Requiring it solved the problem.

这篇关于我该如何关闭TINYINT布尔仿真中的Rails 3.2.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆