-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ordering items #230
Comments
Nvm issue lies with the angular plugin. |
@tommiller1 Thanks for reporting this! I am aware of this bug. It's because Entangled currently doesn't support scopes. In the future, the following collections should work: Model.where(foo: 'bar')
Model.order(created_at: :desc)
Model.first(20)
# etc At the moment, Entangled only understands |
@tommiller1 Also, what NVM issue are you experiencing? |
Nvm = Nevermind It seems to work like its supposed to, the first stream contains the models in whichever order I have chosen with default_scope, subsequent notifications are sent one at a time so no ordering needed there. My problem lied with the angular plugin, it was push'ing newly created models into the 'this.resources.all' array hence the ordering problem. I made some changes to it so I can handle the create/update/destroy actions myself instead of letting the plugin do it all. |
Oh, got it. Yes, the scopes will also have to be understood in the front end instead of just adding to the collection. I'll leave this issue open to mark this todo as pending. |
Hey,
First of all great work on this gem!
I seem to have run into an issue though, my model returns objects in desc order with this:
default_scope -> { order(created_at: :desc) }
The objects returned by entangle in the index method only take this into account on the first fetch. Subsequent fetches append the new objects at the end, is there any way to prepend new objects to the list?
Regards.
The text was updated successfully, but these errors were encountered: