lib/ahnnotate/column.rb in ahnnotate-0.2.0 vs lib/ahnnotate/column.rb in ahnnotate-0.3.0
- old
+ new
@@ -37,10 +37,17 @@
if @default.nil?
return nil
end
if type == "boolean"
- return !ActiveModel::Type::Boolean::FALSE_VALUES.include?(@default)
+ default_is_false =
+ if ActiveRecordVersion.five_and_up?
+ ActiveModel::Type::Boolean::FALSE_VALUES.include?(@default)
+ else
+ ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(@default)
+ end
+
+ return !default_is_false
end
@default
end