acts-as-messageable 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87ccd83bc344a8c0cde5cd004dc44c60256e3e9c
4
+ data.tar.gz: 93736c5ad1616657ec98ae3c2f02550ec9d00bca
5
+ SHA512:
6
+ metadata.gz: cde01b879a3aaecce67535976c81e501a6f74f8c9a268c4e66f11a10af9f9e80d53f92d594341f2666a6343efac9ef78c2a6a10c485428e7d0860560fce44a70
7
+ data.tar.gz: bf849f1ada3703bd7a0c86a897c82296b9ef9034c2a22edffddf0c3eb3baf7a53274822e113dc7ade828d8dac984351491d7bf4ea24bfb59e1dded47a36819e8
data/.coveralls.yml ADDED
File without changes
data/.rspec CHANGED
@@ -1 +1 @@
1
- -fd -color
1
+ -fd -color
data/.travis.yml CHANGED
@@ -1,13 +1,25 @@
1
1
  rvm:
2
2
  - 1.8.7
3
- - 1.9.2
4
3
  - 1.9.3
4
+ - 2.0.0
5
5
  - ruby-head
6
6
  - ree
7
7
  - rbx-head
8
8
  - rbx-head-d19
9
9
  gemfile:
10
- - Gemfile
11
10
  - gemfiles/Gemfile-3.0
12
11
  - gemfiles/Gemfile-3.1
13
12
  - gemfiles/Gemfile-3.2
13
+ - gemfiles/Gemfile-4.0
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
17
+ - rvm: rbx-head
18
+ - rvm: rbx-head-d19
19
+ exclude:
20
+ - rvm: 1.8.7
21
+ gemfile: gemfiles/Gemfile-4.0
22
+ - rvm: ree
23
+ gemfile: gemfiles/Gemfile-4.0
24
+ - rvm: rbx-head
25
+ gemfile: gemfiles/Gemfile-4.0
data/Gemfile CHANGED
@@ -1,12 +1,13 @@
1
- source "http://rubygems.org"
2
-
3
- gem "activerecord", ">= 3.0.0"
4
- gem "activesupport", ">= 3.0.0"
5
- gem "ancestry", "~> 1.3.0"
6
- gem "railties", ">= 3.0.0"
7
-
8
- group :development do
9
- gem "rspec", "~> 2.11.0"
10
- gem "jeweler", "~> 1.8.0"
11
- gem "sqlite3"
12
- end
1
+ source "http://rubygems.org"
2
+
3
+ gem "activerecord", ">= 3.0.0"
4
+ gem "activesupport", ">= 3.0.0"
5
+ gem "ancestry", ">= 1.3.0"
6
+ gem "railties", ">= 3.0.0"
7
+
8
+ group :development do
9
+ gem "rspec", "~> 2.0"
10
+ gem "jeweler", "~> 1.8.0"
11
+ gem "sqlite3"
12
+ gem "coveralls", :require => false
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,121 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionpack (4.0.0)
5
+ activesupport (= 4.0.0)
6
+ builder (~> 3.1.0)
7
+ erubis (~> 2.7.0)
8
+ rack (~> 1.5.2)
9
+ rack-test (~> 0.6.2)
10
+ activemodel (4.0.0)
11
+ activesupport (= 4.0.0)
12
+ builder (~> 3.1.0)
13
+ activerecord (4.0.0)
14
+ activemodel (= 4.0.0)
15
+ activerecord-deprecated_finders (~> 1.0.2)
16
+ activesupport (= 4.0.0)
17
+ arel (~> 4.0.0)
18
+ activerecord-deprecated_finders (1.0.3)
19
+ activesupport (4.0.0)
20
+ i18n (~> 0.6, >= 0.6.4)
21
+ minitest (~> 4.2)
22
+ multi_json (~> 1.3)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 0.3.37)
25
+ addressable (2.3.5)
26
+ ancestry (2.0.0)
27
+ activerecord (>= 3.0.0)
28
+ arel (4.0.0)
29
+ atomic (1.1.10)
30
+ builder (3.1.4)
31
+ colorize (0.5.8)
32
+ coveralls (0.6.7)
33
+ colorize
34
+ multi_json (~> 1.3)
35
+ rest-client
36
+ simplecov (>= 0.7)
37
+ thor
38
+ diff-lcs (1.2.4)
39
+ erubis (2.7.0)
40
+ faraday (0.8.7)
41
+ multipart-post (~> 1.1)
42
+ git (1.2.5)
43
+ github_api (0.10.1)
44
+ addressable
45
+ faraday (~> 0.8.1)
46
+ hashie (>= 1.2)
47
+ multi_json (~> 1.4)
48
+ nokogiri (~> 1.5.2)
49
+ oauth2
50
+ hashie (2.0.5)
51
+ highline (1.6.19)
52
+ httpauth (0.2.0)
53
+ i18n (0.6.4)
54
+ jeweler (1.8.6)
55
+ builder
56
+ bundler (~> 1.0)
57
+ git (>= 1.2.5)
58
+ github_api (= 0.10.1)
59
+ highline (>= 1.6.15)
60
+ nokogiri (= 1.5.10)
61
+ rake
62
+ rdoc
63
+ json (1.8.0)
64
+ jwt (0.1.8)
65
+ multi_json (>= 1.5)
66
+ mime-types (1.23)
67
+ minitest (4.7.5)
68
+ multi_json (1.7.7)
69
+ multi_xml (0.5.4)
70
+ multipart-post (1.2.0)
71
+ nokogiri (1.5.10)
72
+ oauth2 (0.9.2)
73
+ faraday (~> 0.8)
74
+ httpauth (~> 0.2)
75
+ jwt (~> 0.1.4)
76
+ multi_json (~> 1.0)
77
+ multi_xml (~> 0.5)
78
+ rack (~> 1.2)
79
+ rack (1.5.2)
80
+ rack-test (0.6.2)
81
+ rack (>= 1.0)
82
+ railties (4.0.0)
83
+ actionpack (= 4.0.0)
84
+ activesupport (= 4.0.0)
85
+ rake (>= 0.8.7)
86
+ thor (>= 0.18.1, < 2.0)
87
+ rake (10.1.0)
88
+ rdoc (4.0.1)
89
+ json (~> 1.4)
90
+ rest-client (1.6.7)
91
+ mime-types (>= 1.16)
92
+ rspec (2.14.1)
93
+ rspec-core (~> 2.14.0)
94
+ rspec-expectations (~> 2.14.0)
95
+ rspec-mocks (~> 2.14.0)
96
+ rspec-core (2.14.4)
97
+ rspec-expectations (2.14.0)
98
+ diff-lcs (>= 1.1.3, < 2.0)
99
+ rspec-mocks (2.14.1)
100
+ simplecov (0.7.1)
101
+ multi_json (~> 1.0)
102
+ simplecov-html (~> 0.7.1)
103
+ simplecov-html (0.7.1)
104
+ sqlite3 (1.3.7)
105
+ thor (0.18.1)
106
+ thread_safe (0.1.2)
107
+ atomic
108
+ tzinfo (0.3.37)
109
+
110
+ PLATFORMS
111
+ ruby
112
+
113
+ DEPENDENCIES
114
+ activerecord (>= 3.0.0)
115
+ activesupport (>= 3.0.0)
116
+ ancestry (>= 1.3.0)
117
+ coveralls
118
+ jeweler (~> 1.8.0)
119
+ railties (>= 3.0.0)
120
+ rspec (~> 2.0)
121
+ sqlite3
data/README.md CHANGED
@@ -1,278 +1,360 @@
1
- ActsAsMessageable
2
- =================
3
-
4
- The Acts As Messageable allows communication between the models.
5
-
6
- [![Build Status](https://secure.travis-ci.org/LTe/acts-as-messageable.png)](http://travis-ci.org/LTe/acts-as-messageable) [![Dependency Status](https://gemnasium.com/LTe/acts-as-messageable.png)](https://gemnasium.com/LTe/acts-as-messageable)
7
-
8
- Usage
9
- =====
10
-
11
- To use it, add it to your Gemfile:
12
-
13
- ### Rails 3
14
-
15
- ```ruby
16
- gem 'acts-as-messageable'
17
- ```
18
-
19
- ### Rails 2
20
-
21
- Use this [fork](http://github.com/openfirmware/acts-as-messageable)
22
- Thanks for [@openfirmware](http://github.com/openfirmware)
23
-
24
- ```ruby
25
- gem 'acts-as-messageable', :git => 'git://github.com/openfirmware/acts-as-messageable.git',
26
- :branch => 'rails2.3.11_compatible'
27
- ```
28
-
29
- Post instalation
30
- ================
31
-
32
- ```
33
- rails g acts-as-messageable:migration table_name # default 'messages'
34
- rake db:migrate
35
- ```
36
-
37
- Usage
38
- =====
39
-
40
- ```ruby
41
- class User < ActiveRecord::Base
42
- acts_as_messageable :table_name => "table_with_messages", # default 'messages'
43
- :required => :body # default [:topic, :body]
44
- :class_name => "CustomMessages" # default "ActsAsMessageable::Message",
45
- :dependent => :destroy # default :nullify
46
- end
47
- ```
48
-
49
- Upgrade
50
- =======
51
-
52
- Just type once again
53
-
54
- ```
55
- rails g acts-as-messageable:migration
56
- ```
57
-
58
- And new migrations should be created.
59
-
60
- ```
61
- ~$ rails g acts-as-messageable:migration
62
- create db/migrate/20110811223435_add_recipient_permanent_delete_and_sender_permanent_delete_to_messages.rb
63
- ```
64
-
65
- Send message
66
- ============
67
-
68
- ```ruby
69
- @alice = User.first
70
- @bob = User.last
71
-
72
- @alice.send_message(@bob, "Message topic", "Hi bob!")
73
- @bob.send_message(@alice, "Re: Message topic", "Hi alice!")
74
- ```
75
-
76
- ## With hash
77
-
78
- ```ruby
79
- @alice.send_message(@bob, { :body => "Hash body", :topic => "Hash topic" })
80
- ```
81
-
82
- Custom required (validation)
83
- ============================
84
-
85
- In User model
86
-
87
- ```ruby
88
- class User < ActiveRecord::Base
89
- acts_as_messageable :required => :body
90
- end
91
- ```
92
-
93
- ## With hash
94
-
95
- ```ruby
96
- @alice.send_message(@bob, { :body => "Hash body" })
97
- ```
98
-
99
- ## Normal
100
-
101
- ```ruby
102
- @alice.send_message(@bob, "body")
103
- ```
104
-
105
- ## Required sequence
106
-
107
- ```ruby
108
- class User < ActiveRecord::Base
109
- acts_as_messageable :required => [:body, :topic]
110
- end
111
-
112
- @alice.send_message(@bob, "body", "topic")
113
- ```
114
-
115
- ## First topic
116
-
117
- ```ruby
118
- class User < ActiveRecord::Base
119
- acts_as_messageable :required => [:topic, :body]
120
- end
121
-
122
- @alice.send_message(@bob, "topic", "body")
123
- ```
124
-
125
- Conversation
126
- ============
127
-
128
- You can get conversation list from messages scope. For example:
129
-
130
- ```ruby
131
- @message = @alice.send_message(@bob, "Hello bob!", "How are you?")
132
- @reply_message = @bob.reply_to(@message, "Re: Hello bob!", "I'm fine!")
133
-
134
- @alice.received_messages.conversations # => [@reply_message]
135
- ```
136
-
137
- should receive list of latest messages in conversations (like in facebook).
138
-
139
- To create conversation just reply to a message.
140
-
141
- ```ruby
142
- @message = @alice.send_message(@bob, "Hello bob!", "How are you?")
143
- @message.reply("Re: Hello bob!", "I'm fine")
144
- ```
145
-
146
- **Or with hash**
147
-
148
- ```ruby
149
- @message.reply(:topic => "Re: Hello bob!", :body => "I'm fine")
150
- ```
151
-
152
- **Or in old style**
153
-
154
- ```ruby
155
- @message = @alice.send_message(@bob, "Hello bob!", "How are you?")
156
- @reply_message = @bob.reply_to(@message, "Re: Hello bob!", "I'm fine!")
157
- ```
158
-
159
- ## Get conversation for a specific message
160
-
161
- ```ruby
162
- @message.conversation #=> [@message, @reply_message]
163
- @reply_message.conversation #=> [@message, @reply_message]
164
- ```
165
-
166
- Search
167
- ======
168
-
169
- ### Inbox
170
- ```ruby
171
- @alice.received_messages
172
- ```
173
-
174
- ### Outbox
175
- ```ruby
176
- @alice.sent_messages
177
- ```
178
- ### Inbox + Outbox. All messages connected with __@alice__
179
- ```ruby
180
- @alice.messages
181
- ```
182
-
183
- ### Trash
184
- ```ruby
185
- @alice.deleted_messages
186
- ```
187
-
188
- ## Filters
189
- ==========
190
-
191
- ```ruby
192
- @alice.messages.are_from(@bob) # all message form @bob
193
- @alice.messages.are_to(@bob) # all message to @bob
194
- @alice.messages.with_id(@id_of_message) # message with id id_of_message
195
- @alice.messages.readed # all readed @alice messages
196
- @alice.messages.unreaded # all unreaded @alice messages
197
- ```
198
-
199
-
200
- **You can use multiple filters at the same time**
201
-
202
- ```ruby
203
- @alice.messages.are_from(@bob).are_to(@alice).readed # all message from @bob to @alice and readed
204
- @alice.deleted_messages.are_from(@bob) # all deleted messages from @bob
205
- ```
206
-
207
- Read messages
208
- =============
209
-
210
- ### Read message
211
-
212
- ```ruby
213
- @message.open # open message
214
- @message.read
215
- @message.mark_as_read
216
- ```
217
-
218
- ### Unread message
219
-
220
- ```ruby
221
- @message.close # unread message
222
- @message.mark_as_unread
223
- ```
224
-
225
-
226
- Delete message
227
- ==============
228
-
229
- **__We must know who delete message. That why we use *.process* method to save context__**
230
-
231
- ```ruby
232
- @message = @alice.send_message(@bob, "Topic", "Body")
233
-
234
- @alice.messages.process do |message|
235
- message.delete # @alice delete message
236
- end
237
- ```
238
-
239
- Now we can find message in **trash**
240
-
241
- ```ruby
242
- @alice.deleted_messages #=> [@message]
243
- ```
244
-
245
- We can delete the message **permanently**
246
-
247
- ```ruby
248
- @alice.deleted_messages.process do |message|
249
- message.delete
250
- end
251
-
252
- @alice.delete_message #=> []
253
- ```
254
-
255
- Message has been deleted **permanently**
256
-
257
- ## Delete message without context
258
-
259
- ```ruby
260
- @alice.delete_message(@message) # @alice delete @message
261
- ```
262
-
263
- Restore message
264
- ===============
265
-
266
- ```ruby
267
- @alice.deleted_messages.process do |m|
268
- m.restore # @alice restore 'm' message from trash
269
- end
270
- ```
271
-
272
- ## Restore message without context
273
-
274
- ```ruby
275
- @alice.restore_message(@message) # @alice restore message from trash
276
- ```
277
-
278
- Copyright © 2011 Piotr Niełacny (http://ruby-blog.pl), released under the MIT license
1
+ ActsAsMessageable
2
+ =================
3
+
4
+ The Acts As Messageable allows communication between the models.
5
+
6
+ [![Build Status](https://secure.travis-ci.org/LTe/acts-as-messageable.png)](http://travis-ci.org/LTe/acts-as-messageable)
7
+ [![Dependency Status](https://gemnasium.com/LTe/acts-as-messageable.png)](https://gemnasium.com/LTe/acts-as-messageable)
8
+ [![Code Climate](https://codeclimate.com/github/LTe/acts-as-messageable.png)](https://codeclimate.com/github/LTe/acts-as-messageable)
9
+ [![Coverage Status](https://coveralls.io/repos/LTe/acts-as-messageable/badge.png?branch=master)](https://coveralls.io/r/LTe/acts-as-messageable?branch=master)
10
+ [![Gem Version](https://badge.fury.io/rb/acts-as-messageable.png)](http://badge.fury.io/rb/acts-as-messageable)
11
+
12
+ Usage
13
+ =====
14
+
15
+ To use it, add it to your Gemfile:
16
+
17
+ ### Rails 3
18
+
19
+ ```ruby
20
+ gem 'acts-as-messageable'
21
+ ```
22
+
23
+ ### Rails 2
24
+
25
+ Use this [fork](http://github.com/openfirmware/acts-as-messageable)
26
+ Thanks for [@openfirmware](http://github.com/openfirmware)
27
+
28
+ ```ruby
29
+ gem 'acts-as-messageable', :git => 'git://github.com/openfirmware/acts-as-messageable.git',
30
+ :branch => 'rails2.3.11_compatible'
31
+ ```
32
+
33
+ Post installation
34
+ =================
35
+
36
+ ```
37
+ rails g acts-as-messageable:migration table_name # default 'messages'
38
+ rake db:migrate
39
+ ```
40
+
41
+ Usage
42
+ =====
43
+
44
+ ```ruby
45
+ class User < ActiveRecord::Base
46
+ acts_as_messageable :table_name => "table_with_messages", # default 'messages'
47
+ :required => :body # default [:topic, :body]
48
+ :class_name => "CustomMessages" # default "ActsAsMessageable::Message",
49
+ :dependent => :destroy # default :nullify
50
+ :group_messages => true # default false
51
+ end
52
+ ```
53
+
54
+ Upgrade
55
+ =======
56
+
57
+ Just type once again
58
+
59
+ ```
60
+ rails g acts-as-messageable:migration
61
+ ```
62
+
63
+ And new migrations should be created.
64
+
65
+ ```
66
+ ~$ rails g acts-as-messageable:migration
67
+ create db/migrate/20110811223435_add_recipient_permanent_delete_and_sender_permanent_delete_to_messages.rb
68
+ ```
69
+
70
+ Send message
71
+ ============
72
+
73
+ ```ruby
74
+ @alice = User.first
75
+ @bob = User.last
76
+
77
+ @alice.send_message(@bob, "Message topic", "Hi bob!")
78
+ @bob.send_message(@alice, "Re: Message topic", "Hi alice!")
79
+ ```
80
+
81
+ ## With hash
82
+
83
+ ```ruby
84
+ @alice.send_message(@bob, { :body => "Hash body", :topic => "Hash topic" })
85
+ ```
86
+
87
+ Custom required (validation)
88
+ ============================
89
+
90
+ In User model
91
+
92
+ ```ruby
93
+ class User < ActiveRecord::Base
94
+ acts_as_messageable :required => :body
95
+ end
96
+ ```
97
+
98
+ ## With hash
99
+
100
+ ```ruby
101
+ @alice.send_message(@bob, { :body => "Hash body" })
102
+ ```
103
+
104
+ ## Normal
105
+
106
+ ```ruby
107
+ @alice.send_message(@bob, "body")
108
+ ```
109
+
110
+ ## Required sequence
111
+
112
+ ```ruby
113
+ class User < ActiveRecord::Base
114
+ acts_as_messageable :required => [:body, :topic]
115
+ end
116
+
117
+ @alice.send_message(@bob, "body", "topic")
118
+ ```
119
+
120
+ ## First topic
121
+
122
+ ```ruby
123
+ class User < ActiveRecord::Base
124
+ acts_as_messageable :required => [:topic, :body]
125
+ end
126
+
127
+ @alice.send_message(@bob, "topic", "body")
128
+ ```
129
+
130
+ Custom class
131
+ ============
132
+
133
+ You can use your own class that will represent the message object. First of all create custom class
134
+
135
+ ```ruby
136
+ class CustomMessage < ActsAsMessageable::Message
137
+ def capitalize_title
138
+ title.capitalize
139
+ end
140
+ end
141
+ ```
142
+
143
+ After that you can sepcify custom class in options.
144
+
145
+ ```ruby
146
+ class User
147
+ acts_as_messageable :class_name => "CustomMessage"
148
+ end
149
+ ```
150
+
151
+ From now on, your message has custom class.
152
+
153
+ ```ruby
154
+ @message = @alice.send_message(@bob, "hi!")
155
+ @message # => #<CustomMessage:0x000000024b6278>
156
+ @message.capitalize_title # => "Hi!"
157
+ ```
158
+
159
+ Conversation
160
+ ============
161
+
162
+ You can get conversation list from messages scope. For example:
163
+
164
+ ```ruby
165
+ @message = @alice.send_message(@bob, "Hello bob!", "How are you?")
166
+ @reply_message = @bob.reply_to(@message, "Re: Hello bob!", "I'm fine!")
167
+
168
+ @alice.received_messages.conversations # => [@reply_message]
169
+ ```
170
+
171
+ should receive list of latest messages in conversations (like in facebook).
172
+
173
+ To create conversation just reply to a message.
174
+
175
+ ```ruby
176
+ @message = @alice.send_message(@bob, "Hello bob!", "How are you?")
177
+ @message.reply("Re: Hello bob!", "I'm fine")
178
+ ```
179
+
180
+ **Or with hash**
181
+
182
+ ```ruby
183
+ @message.reply(:topic => "Re: Hello bob!", :body => "I'm fine")
184
+ ```
185
+
186
+ **Or in old style**
187
+
188
+ ```ruby
189
+ @message = @alice.send_message(@bob, "Hello bob!", "How are you?")
190
+ @reply_message = @bob.reply_to(@message, "Re: Hello bob!", "I'm fine!")
191
+ ```
192
+
193
+ ## Get conversation for a specific message
194
+
195
+ ```ruby
196
+ @message.conversation #=> [@message, @reply_message]
197
+ @reply_message.conversation #=> [@message, @reply_message]
198
+ ```
199
+
200
+ Search
201
+ ======
202
+
203
+ You can search text from messages and get the records where match exist. For example:
204
+
205
+ ### Search text from messages
206
+
207
+ ```ruby
208
+ records = @alice.messages.search("Search me") @alice seach text "Search me" from all messages
209
+ ```
210
+
211
+ ### Inbox
212
+ ```ruby
213
+ @alice.received_messages
214
+ ```
215
+
216
+ ### Outbox
217
+ ```ruby
218
+ @alice.sent_messages
219
+ ```
220
+ ### Inbox + Outbox. All messages connected with __@alice__
221
+ ```ruby
222
+ @alice.messages
223
+ ```
224
+
225
+ ### Trash
226
+ ```ruby
227
+ @alice.deleted_messages
228
+ ```
229
+
230
+ ## Filters
231
+ ==========
232
+
233
+ ```ruby
234
+ @alice.messages.are_from(@bob) # all message form @bob
235
+ @alice.messages.are_to(@bob) # all message to @bob
236
+ @alice.messages.with_id(@id_of_message) # message with id id_of_message
237
+ @alice.messages.readed # all readed @alice messages
238
+ @alice.messages.unreaded # all unreaded @alice messages
239
+ ```
240
+
241
+
242
+ **You can use multiple filters at the same time**
243
+
244
+ ```ruby
245
+ @alice.messages.are_from(@bob).are_to(@alice).readed # all message from @bob to @alice and readed
246
+ @alice.deleted_messages.are_from(@bob) # all deleted messages from @bob
247
+ ```
248
+
249
+ Read messages
250
+ =============
251
+
252
+ ### Read message
253
+
254
+ ```ruby
255
+ @message.open # open message
256
+ @message.read
257
+ @message.mark_as_read
258
+ ```
259
+
260
+ ### Unread message
261
+
262
+ ```ruby
263
+ @message.close # unread message
264
+ @message.mark_as_unread
265
+ ```
266
+
267
+
268
+ Delete message
269
+ ==============
270
+
271
+ **__We must know who delete message. That why we use *.process* method to save context__**
272
+
273
+ ```ruby
274
+ @message = @alice.send_message(@bob, "Topic", "Body")
275
+
276
+ @alice.messages.process do |message|
277
+ message.delete # @alice delete message
278
+ end
279
+ ```
280
+
281
+ Now we can find message in **trash**
282
+
283
+ ```ruby
284
+ @alice.deleted_messages #=> [@message]
285
+ ```
286
+
287
+ We can delete the message **permanently**
288
+
289
+ ```ruby
290
+ @alice.deleted_messages.process do |message|
291
+ message.delete
292
+ end
293
+
294
+ @alice.delete_message #=> []
295
+ ```
296
+
297
+ Message has been deleted **permanently**
298
+
299
+ ## Delete message without context
300
+
301
+ ```ruby
302
+ @alice.delete_message(@message) # @alice delete @message
303
+ ```
304
+
305
+ Restore message
306
+ ===============
307
+
308
+ ```ruby
309
+ @alice.deleted_messages.process do |m|
310
+ m.restore # @alice restore 'm' message from trash
311
+ end
312
+ ```
313
+
314
+ ## Restore message without context
315
+
316
+ ```ruby
317
+ @alice.restore_message(@message) # @alice restore message from trash
318
+ ```
319
+
320
+ Group message
321
+ =============
322
+
323
+ ## Enable group messages
324
+
325
+ ```ruby
326
+ class User
327
+ acts_as_messageable :group_messages => true
328
+ end
329
+ ```
330
+
331
+ ## How to join other users's conversation
332
+
333
+ ```ruby
334
+ @message = @alice.send_message(@bob, :topic => "Helou bob!", :body => "What's up?")
335
+ @reply_message = @sukhi.reply_to(@message, "Hi there!", "I would like to join to this conversation!")
336
+ @sec_reply_message = @bob.reply_to(@message, "Hi!", "Fine!")
337
+ @third_reply_message = @alice.reply_to(@reply_message, "hi!", "no problem")
338
+ ```
339
+
340
+ ## Know the people involved in conversation
341
+
342
+ ```ruby
343
+ @message.people # will give you participants users object
344
+ @message.people # => [@alice, @bob, @sukhi]
345
+ ```
346
+
347
+ Search
348
+ ======
349
+
350
+ ## Search text from messages
351
+
352
+ ```ruby
353
+ @alice.messages.search("Search me") @alice seach text "Search me" from all messages
354
+ ```
355
+
356
+ Copyright © 2011-2012 Piotr Niełacny (http://ruby-blog.pl), released under the MIT license
357
+
358
+
359
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/LTe/acts-as-messageable/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
360
+