Class: RecordLoader::RobotPropertyLoader
- Inherits:
-
ApplicationRecordLoader
- Object
- Base
- ApplicationRecordLoader
- RecordLoader::RobotPropertyLoader
- Defined in:
- lib/record_loader/robot_property_loader.rb
Overview
Creates the specified robot properties if they are not present
Instance Method Summary collapse
Methods inherited from ApplicationRecordLoader
Instance Method Details
#create_or_update!(name, options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/record_loader/robot_property_loader.rb', line 11 def create_or_update!(name, ) # find the robot by name r = Robot.find_by(name:) return if r.blank? # find or create each property ['properties'].each do || ['robot_id'] = r.id RobotProperty.create_with().find_or_create_by!(robot_id: r.id, key: ['key']) end end |