Module: ActiveUUID::Patches::Quoting
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/activeuuid/patches.rb
Class Method Summary collapse
Instance Method Summary collapse
- #native_database_types ⇒ Object
- #quote(value, column = nil) ⇒ Object
- #type_cast(value, column = nil) ⇒ Object
Class Method Details
.prepended(_klass) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/activeuuid/patches.rb', line 121 def self.prepended(_klass) def quote(value, column = nil) # silence quoted_id warning until rails 5.2 (Must fix before rails 5.2) ActiveSupport::Deprecation.silence do value = UUIDTools::UUID.serialize(value) if column&.type == :uuid case method(__method__).super_method.arity when 1 then super(value) else super end end end def type_cast(value, column = nil) value = UUIDTools::UUID.serialize(value) if column&.type == :uuid super end def native_database_types super.merge(uuid: { name: "binary", limit: 16 }) end end |
Instance Method Details
#native_database_types ⇒ Object
138 139 140 |
# File 'lib/activeuuid/patches.rb', line 138 def native_database_types super.merge(uuid: { name: "binary", limit: 16 }) end |
#quote(value, column = nil) ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/activeuuid/patches.rb', line 122 def quote(value, column = nil) # silence quoted_id warning until rails 5.2 (Must fix before rails 5.2) ActiveSupport::Deprecation.silence do value = UUIDTools::UUID.serialize(value) if column&.type == :uuid case method(__method__).super_method.arity when 1 then super(value) else super end end end |