Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Gel all conversations #32

Closed
breiko83 opened this Issue Oct 4, 2012 · 10 comments

Comments

Projects
None yet
4 participants

breiko83 commented Oct 4, 2012

Is there a way to retrieve the list of conversations ordered by last answered?
Thanks.

Owner

LTe commented Oct 4, 2012

You can use roots method on messages. And after that on each root message you can execute method conversation.

Example:

@user = User.last
@roots_messages = @user.messages.roots
@conversations = @roots_messages.map { |root| root.conversation }

I think this method should be available in gem.

breiko83 commented Oct 4, 2012

Thanks for quick answer.
But how to order by last conversation answered?

breiko83 commented Oct 4, 2012

I think the code should update the field "updated_at" of the root message when someone answer. This way we can sort roots by updated_at. Do you agree?

Owner

LTe commented Oct 4, 2012

I think in gem should be available method that return latest messages from the conversation (like in facebook).

LTe added a commit that referenced this issue Dec 10, 2012

LTe added a commit that referenced this issue Dec 10, 2012

LTe added a commit that referenced this issue Dec 10, 2012

Owner

LTe commented Dec 10, 2012

@breiko83 I added #conversations method to gem. Please re-open this issue in case of any problems.

@LTe LTe closed this Dec 10, 2012

tigus commented Dec 14, 2012

hello

tx for this great gem it s very nice :)

i just install your gem in my rails 3 app
i have 0.4.7 version

but conversations method is missing

module ActsAsMessageable
module Relation
attr_accessor :relation_context

def process(context = self.relation_context, &block)
  self.each do |message|
    block.call(message) if block_given?
    context.delete_message(message)   if message.removed
    context.restore_message(message)  if message.restored
  end
end

end
end

how i can get version with this method ?

thank you

guyisra commented Dec 14, 2012

I think its because travis fails at the tests, so it doesn't get updated

use

gem 'acts-as-messageable', :git => 'git://github.com/LTe/acts-as-messageable.git'

tigus commented Dec 14, 2012

ok tx for your response

what is "travis" in fact :) ?

guyisra commented Dec 14, 2012

travis is automatic continuos integration that tests the gem constantly every change
https://travis-ci.org/LTe/acts-as-messageable

tigus commented Dec 14, 2012

ok nice :)

tx

i did nt know that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment