From e27f075d2a85e3331cb1783c9e59d815503905d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Nie=C5=82acny?= Date: Tue, 3 Aug 2010 23:06:13 +0200 Subject: [PATCH] * Add readme and license. --- MIT-LICENSE | 20 ++++++++++++++++++++ README | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 MIT-LICENSE diff --git a/MIT-LICENSE b/MIT-LICENSE new file mode 100644 index 000000000..ef65f89ba --- /dev/null +++ b/MIT-LICENSE @@ -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. \ No newline at end of file diff --git a/README b/README index e69de29bb..1e677afa9 100644 --- a/README +++ b/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 + \ No newline at end of file