Class: ActiveCortex::Generator::HasMany
Instance Attribute Summary
#field_name, #max_results, #model, #record
Class Method Summary
collapse
Instance Method Summary
collapse
generate, #initialize
Class Method Details
.accepts?(record:, field_name:) ⇒ Boolean
2
3
4
|
# File 'lib/active_cortex/generator/has_many.rb', line 2
def self.accepts?(record:, field_name:)
record.class.reflect_on_association(field_name)&.collection?
end
|
Instance Method Details
#generation ⇒ Object
10
11
12
13
14
|
# File 'lib/active_cortex/generator/has_many.rb', line 10
def generation
generate_tool_calls.map do |tool_call|
build_record_from_tool_call(tool_call)
end
end
|
#save_generation ⇒ Object
6
7
8
|
# File 'lib/active_cortex/generator/has_many.rb', line 6
def save_generation
record.send(field_name).push(generation)
end
|