class ActiveRecord::Relation
Public Instance Methods
update_store(store_name)
click to toggle source
# File lib/pgrel/active_record/relation.rb, line 5 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 Instance Methods
store_type_error_msg(type)
click to toggle source
# File lib/pgrel/active_record/relation.rb, line 15 def store_type_error_msg(type) "Column type is not a known store: #{type}" end