-
Notifications
You must be signed in to change notification settings - Fork 0
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
Is it possible to get all messages after a datetime? #4
Comments
Well... this works: entangled.angular.js:
Rails controller:
But the problem is parameters are statically setup and can never change (because webSockets URL is setup only once) Maybe I should code a no standard action, not sure how much of the 'magic' will loose on that. |
What you need is what I would summarize as "scoping", such as where clauses etc. Scoping is currently not supported, but is on my todo list. I'll leave this issue open until this is addressed. |
If it helps, and your performance concern is about the client (such as client side rendering), and not about the server, you can still filter your messages on the client after fetching them: Message.all(function (err, messages) {
if (!err) {
$scope.messages = messages.filter(function (message) {
return message.createdAt > 2 weeks ago // pseudo code
});
}
}); This would at least speed up the rendering of your messages. In this example, the client would ignore messages older than 2 weeks. Just to be clear, if you have thousands of messages in your database, those will only be loaded the first time you invoke |
Thanks. |
Dennis,
I am trying to make a chat with your gem where parent/children are chatroom/messages.
If I setup
Message.all( )
, everytime a message is createdMessage.all()
is called and fetches all messages.That is fine when you have a dozen messages, but if you have thousand of messages...
So, I thought of passing an object to
.all()
, like you can do on.create()
, so that I can filter messages after some date on Rails controller. Something like:Message.all({last: 'Sat Apr 09 2016 00:32:13 GMT-0300 (BRT)'}, function() {...} )
Would that be possible with current Entangled?
How and Where would be better to hack such a feature?
The text was updated successfully, but these errors were encountered: