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

allow scopes to return AR models as well #77

Open catmando opened 6 years ago

catmando commented 6 years ago

AR lets you do this: scope :foo -> () { self }

but hypermesh expects scopes to always return relationships

you can effectively get this result by doing scope :foo, -> () { .....all } in other words apply all to every scope. This works except if you were to do this:

MyModel.unscoped.foo which would apply all when it shouldn't. So its a bit harder that automatically doing the above.