Permalink
Browse files

* Add readme and license.

  • Loading branch information...
1 parent c35e84b commit e27f075d2a85e3331cb1783c9e59d815503905d4 @LTe committed Aug 3, 2010
Showing with 59 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +39 −0 README
View
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Piotr Niełacny Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
39 README
@@ -0,0 +1,39 @@
+= ActsAsMessageable
+The Acts As Messageable allows communication between the models.
+
+== Usage
+To use it, add it to your Gemfile:
+
+ gem 'acts-as-messageable'
+
+== Post instalation
+
+1. rails g acts_as_messageable:migration
+2. rake db:migrate
+
+== Usage
+
+ class User < ActiveRecord::Base
+ acts_as_messageable
+ end
+
+ @user1 = User.first
+ @user2 = User.last
+
+ # user1 send message to user2
+ @user1.send_msg(@user2, "Message to user2", "Hi user 2!;-)")
+ @user2.send_msg(@user1, "Re: Message to user2", "Hi there!:)")
+
+ # Show inbox
+ @user1.recv
+ # Show outbox
+ @user1.sent
+
+ # Search message
+ @user1.msg # all messages (in and out)
+ @user1.msg(:from => @user2) # all messages from @user2
+ @user1.msg(:to => @user2) # all messages to @user2
+ @user1.msg(:id => 2) # message where message.id = 2
+
+Copyright © 2010 Piotr Niełacny (http://ruby-blog.pl), released under the MIT license
+

0 comments on commit e27f075

Please sign in to comment.