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

add a `record.load` method #97

Open catmando opened 6 years ago

catmando commented 6 years ago

if for some reason you want to insure all attributes are loaded you have to say:

  # trip is some record instance ... 
  Hyperloop::Model.load do 
    trip.attr1
    trip.attr2
    trip.attr3
    trip
  end.then do |trip|
    # everything you asked for in the load is loaded
  end

the problem is that hyperloop currently has no way of knowing which attributes are legal, so the developer has to list the attributes out based on their understanding of the current context/acting user.

Instead this would be nice: trip.load. This would have to be a new server op, as we want to use server-side policies to get the the list of available attributes for the current user, and then return the data.

mareczek commented 6 years ago

+1 +1 +1 +1 +1 +1