I get an error with the messages method (inbox/outbox) #5

Closed
angelacode opened this Issue Jun 29, 2011 · 2 comments

Projects

None yet

2 participants

@angelacode

I have the following:

   u1.send_message(u2, {:body => "body", :topic => "topic"})
   u1.messages
  >>[]

If I send a message, the user that sent the message shows no message.

@LTe LTe closed this Jul 2, 2011
@LTe LTe reopened this Jul 2, 2011
Owner
LTe commented Jul 2, 2011

I can't reproduce

rails new acts_test
cd acts_test

My Gemfile

source 'http://rubygems.org'

gem 'rails', '3.0.9'
gem "acts-as-messageable"
gem 'sqlite3'

Next

rails g model User name:string
rails g acts-as-messageable:migration
rake db:migrate

User model

# app/model/user.rb

class User < ActiveRecord::Base
  acts_as_messageable
end

In console

ruby-1.9.2-p0 > @alice = User.create :name => "Alice"
 => #<User id: 1, name: "Alice", created_at: "2011-07-02 16:33:51", updated_at: "2011-07-02 16:33:51"> 
ruby-1.9.2-p0 > @bob = User.create :name => "Bob"
 => #<User id: 2, name: "Bob", created_at: "2011-07-02 16:34:09", updated_at: "2011-07-02 16:34:09"> 
ruby-1.9.2-p0 > @alice.send_message(@bob, { :topic => "Topic", :body => "Body" })
 => #<ActsAsMessageable::Message id: 1, topic: "Topic", body: "Body", received_messageable_id: 2, received_messageable_type: "User", sent_messageable_id: 1, sent_messageable_type: "User", opened: false, recipient_delete: false, sender_delete: false, ancestry: nil> 
ruby-1.9.2-p0 > @alice.messages
 => [#<ActsAsMessageable::Message id: 1, topic: "Topic", body: "Body", received_messageable_id: 2, received_messageable_type: "User", sent_messageable_id: 1, sent_messageable_type: "User", opened: false, recipient_delete: false, sender_delete: false, ancestry: nil>]
Owner
LTe commented Jul 16, 2011

Please reopen when you will have problems with this.

@LTe LTe closed this Jul 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment