Sha256: b0e69861034793228d20195759b686bb3f334e0dd07670d679a74a967d8bbe8e
Contents?: true
Size: 560 Bytes
Versions: 1
Compression:
Stored size: 560 Bytes
Contents
# frozen_string_literal: true module ActiveRecord class Relation def update_store(store_name) raise ArgumentError, "Empty store name to update" if store_name.blank? type = type_for_attribute(store_name.to_s).type raise TypeConflictError, store_type_error_msg(type) if %i[hstore jsonb].exclude?(type) klass = "ActiveRecord::Store::Flexible#{type.capitalize}".constantize klass.new(self, store_name) end private def store_type_error_msg(type) "Column type is not a known store: #{type}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pgrel-0.3.1 | lib/pgrel/active_record/relation.rb |