Class: ActsAsTable::RecordModelClassMethods::Inject

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
app/models/concerns/acts_as_table/record_model_class_methods.rb

Overview

ActsAsTable "non-destructive" traversal (does not create new records if they are not found).

Instance Method Summary collapse

Instance Method Details

#inject(acc, record_model) {|acc, path| ... } ⇒ Object

Combine all ActsAsTable paths using an associative binary operation.

Parameters:

Yield Parameters:

Yield Returns:

  • (Object)

Returns:

  • (Object)


79
80
81
82
83
84
85
86
87
88
89
90
# File 'app/models/concerns/acts_as_table/record_model_class_methods.rb', line 79

def inject(acc, record_model, &block)
  # @return [Class]
  klass = record_model.class_name.constantize

  # @return [ActsAsTable::Path]
  path = ActsAsTable::Path.new(klass, nil, data: {
    source_record_model: nil,
    target_record_model: record_model,
  })

  _inject(acc, path, &block)
end