class ActionBlocks::MatchConditionBuilder
Base - Refers to the selecting model and fields on selecting model Related - Refers to the selected model and fields on selected model e.g. When a Work Order selects Items
Item is Related Model WorkOrder is Base Model
When building a match condition, its defined in the Base Models builder. e.g. When a Work Order selects Items
This selection is declared in the Work Order Model
When using a selection to select related items, such as a table the Base Model (Work Order) feels a bit misnamed from this context as Items are being selected and form the foundation of the query.
Attributes
base_field_id[RW]
parent_model[RW]
Public Instance Methods
base_match_reqs()
click to toggle source
# File lib/action_blocks/builders/model_builder.rb, line 197 def base_match_reqs if @base_value { path: [@base_value] } else field_reqs = base_field.match_requirements(@base_model.active_model) { path: field_reqs[:path] } end end
before_build(parent, base_field, predicate, related_field)
click to toggle source
# File lib/action_blocks/builders/model_builder.rb, line 181 def before_build(parent, base_field, predicate, related_field) if base_field.is_a? Symbol @base_model = parent.base_model @base_field_id = base_field @base_field_key = "field-#{parent.base_model.id}-#{@base_field_id}" else @base_value = base_field end @related_model = parent.related_model @related_field_id = related_field @related_field_key = "field-#{parent.related_model_id}-#{@related_field_id}" @predicate = predicate end
match_reqs()
click to toggle source
# File lib/action_blocks/builders/model_builder.rb, line 217 def match_reqs { base_path: base_match_reqs[:path], predicate: @predicate, related_path: related_match_reqs[:path] } end