mailboxer 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,6 @@ And don't forget to migrate you database:
27
27
 
28
28
  = Requirements
29
29
 
30
- OUTDATED - It will be documented in the next days
31
30
  We are now adding support for sending emails when a Notification or a Message is sent to one o more recipients. So that, we mus assure that Messageable models have some specific methods. This methods are:
32
31
 
33
32
  #Returning any kind of indentification you want for the model
@@ -45,8 +44,22 @@ We are now adding support for sending emails when a Notification or a Message is
45
44
  return true
46
45
  end
47
46
 
48
- If these methods are not present, default ones will be created (the ones above).
49
- /OUTDATED
47
+ These names are explicit enough to not collide with other methods, but as long as you need to change them you can do it by using mailboxer intializer. Just add or uncomment the following lines:
48
+
49
+ #Configures the methods needed by mailboxer
50
+ config.email_method = :email
51
+ config.name_method = :name
52
+ config.should_email_method = :should_email?
53
+
54
+ You may change to whatever you want or need. For example:
55
+
56
+ config.email_method = :notifications_email
57
+ config.name_method = :display_name
58
+ config.should_email_method = :do_you_want_this_to_be_mailed?
59
+
60
+ Will use the method "notification_email" instead of "email", "display_name" for "name" and "do_you_want_this_to_be_mailed?" for "should_email?"
61
+
62
+ Using default or custom method names, if your model doesn't implement them, Mailboxer will use dummy methods not to crash but notify you the missing methods.
50
63
 
51
64
  = Usage
52
65
 
@@ -9,8 +9,8 @@ class Notification < ActiveRecord::Base
9
9
  scope :recipient, lambda { |recipient|
10
10
  joins(:receipts).where('receipts.receiver_id' => recipient.id,'receipts.receiver_type' => recipient.class.to_s)
11
11
  }
12
- scope :find_by_object, lambda { |object|
13
- where('object_id' => object.id,'object_type' => object.class.to_s)
12
+ scope :with_object, lambda { |obj|
13
+ where('object_id' => obj.id,'object_type' => obj.class.to_s)
14
14
  }
15
15
  scope :not_trashed, lambda {
16
16
  joins(:receipts).where('receipts.trashed' => false)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "mailboxer"
3
- s.version = "0.3.1"
3
+ s.version = "0.3.2"
4
4
  s.authors = ["Eduardo Casanova Cuesta"]
5
5
  s.summary = "Messaging system for rails apps."
6
6
  s.description = "A Rails engine that allows any model to act as messageable, permitting it interchange messages with any other messageable model." +
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailboxer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eduardo Casanova Cuesta