[英]Rails 4 oracle enhanced adapter matching number(1) fields
我有一個legacy db
,正在上面構建rails 4
應用程序。
在我的數據庫模式中 ,有很多字段具有單位數字的非布爾數(例如1-9),其中使用了Number(1)
的數據類型。 但是,oracle適配器自動假定數據類型number(1)
始終為布爾值。
從這個問題中可以看出(Rails3除了4似乎是相同的) Rails 3數據類型?
我試圖在oea github頁面上找到一個選項,但是找不到。
指向正確方向的指針會很棒。
從https://github.com/rsim/oracle-enhanced/issues/338
這是默認行為,也可以根據需要禁用。
##
# :singleton-method:
# By default, the OracleEnhancedAdapter will consider all columns of type <tt>NUMBER(1)</tt>
# as boolean. If you wish to disable this emulation you can add the following line
# to your initializer file:
#
# ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans = false
cattr_accessor :emulate_booleans
self.emulate_booleans = true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.