Class: PgTagsOn::Repositories::ArrayValue::Delete

Inherits:
Object
  • Object
show all
Includes:
ActiveRecord::Arel
Defined in:
lib/pg_tags_on/repositories/array_value/delete.rb

Overview

This class is respnsible to delete tags stored as JSON objects.

Instance Method Summary collapse

Methods included from ActiveRecord::Arel

#arel_array_cat, #arel_array_remove, #arel_array_replace, #arel_bind, #arel_build_quoted, #arel_cast, #arel_distinct, #arel_function, #arel_infix_operation, #arel_jsonb_extract_path, #arel_query_attribute, #arel_sql, #arel_unnest

Instance Method Details

#call(repository:, relation:, tags:, returning: nil) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/pg_tags_on/repositories/array_value/delete.rb', line 12

def call(repository:, relation:, tags:, returning: nil)
  @repository = repository
  @tags = tags

  repository.update_attributes relation: relation,
                               attributes: { column_name => arel_function('array', active_tags) },
                               returning: returning
end