Skip to content

Instantly share code, notes, and snippets.

@jdar
Created September 8, 2009 19:16
Show Gist options
  • Save jdar/183153 to your computer and use it in GitHub Desktop.
Save jdar/183153 to your computer and use it in GitHub Desktop.
I am mapping devices. Led is a light emitting diode. BluetoothDetector is a modular microcontroller that holds the logic and is
I have an ARobject BluetoothDetector which inherits (but is NOT STI) from ArduinoBt.
p = BluetoothDetector.first; p
=> #<BluetoothDetector id: 1, name: "the main controller device">
>> p.children << BluetoothDetector.create(:name=>'slave device')
=> [#<BluetoothDetector id: 45, name: "slave device">]
>> DeviceConnection.first
=> #<DeviceConnection id: 5, child_id: 45, child_type: "ArduinoBt", parent_id: 1, parent_type: "ArduinoBt">
# reload environment
p.children << Led.create
=> [
#<ArduinoBt id: 45, name: "slave device"l>,
#<Led id: 225, brightness: nil, amperage: nil, wavelength: nil>
]
Hmmm. I can't seem to override the "child_type" class_name while saving.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment