ruby-hyperloop / hyper-mesh

The project has moved to Hyperstack!! - Synchronization of active record models across multiple clients using Pusher, ActionCable, or Polling
https://hyperstack.org/
MIT License
22 stars 12 forks source link

cleanup AR#inspect and consistently use same FORMAT everywhere #74

Closed catmando closed 6 years ago

catmando commented 6 years ago

For AR record instances show the object id (in hex) of the backing record followed by the object_id (in hex) of the actual instance. This makes sense because all reactions and activities on an AR instance are passed through to the backing record. The AR instance only exists in cases where two different search vectors end of up at the same actual AR record.

<TodoItem:0x0FFF (0x0ABC) ... >

For new records (not yet attempted to be saved) show the attributes that have been assigned. Do not show relationships.

<TodoItem:0x0FFF (0x0ABC) [new {"title"=>"test"}] >

For records that are loading show the vector being fetched.

<TodoItem:0x0FFF (0x0ABC) [loading TodoItem,find_by,{"title"=>"test2"}] >

For loaded / saved records show the DB primary key id.

<TodoItem:0x0FFF (0x0ABC) [loaded id: 1] >

For records that have changed after loading / saving show the primary key id followed by the changes. Do not include relationships.

<TodoItem:0x0FFF (0x0ABC) [changed id: 1 {"title"=>["test3", "new title"]}] >

For records that have been destroyed show the primary key id.

<TodoItem:0x0FFF (0x0ABC) [destroyed id: 1] >

For records that have errors show the errors. If the record exists in the DB also show the primary key id.

<TodoItem:0x0FFF (0x0ABC) [errors {"title"=>["can't be blank"]}] > <TodoItem:0x0FFF (0x0ABC) [errors id: 1 {"title"=>["can't be blank"]}] >

Also use hex in json back and forth from server for object ids.