unidom-contact 1.0.1 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0388ebeaedab50c13f573c893cd2b2760df9860
|
4
|
+
data.tar.gz: fbec7f5bbbd605149682b1f7aa56a6e5664b8640
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 484a7df9728f15ee8914fe1765aff14981b01cf684f763d6a99dcb00d51da548fae239bea64c96bb430be5d2bb1ed08fb954b2d801d97152e78b68dee29eb315
|
7
|
+
data.tar.gz: a6a19549b8c82604038a4552375d2a7cfeeabb33014a4bb7e50f8392cb5969eaee7406d01905510a483902c5f9682cf9bbde0d8ca566536fb97f046c98d23bf4
|
data/README.md
CHANGED
@@ -40,3 +40,17 @@ Unidom::Contact::EmailAddress.full_address_is('topbit.du@gmail.com').first
|
|
40
40
|
# Find the Email Address
|
41
41
|
|
42
42
|
```
|
43
|
+
|
44
|
+
## Include the Concerns
|
45
|
+
```ruby
|
46
|
+
include Unidom::Contact::Concerns::AsContact
|
47
|
+
include Unidom::Contact::Concerns::AsSubscriber
|
48
|
+
```
|
49
|
+
|
50
|
+
### As Contact concern
|
51
|
+
The As Contact concern do the following tasks for the includer automatically:
|
52
|
+
1. Define the has_many :contact_subscriptions macro as: ``has_many :contact_subscriptions, class_name: 'Unidom::Contact::ContactSubscription', as: :contact``
|
53
|
+
|
54
|
+
### As Subscriber concern
|
55
|
+
The As Subscriber concern do the following tasks for the includer automatically:
|
56
|
+
1. Define the has_many :contact_subscriptions macro as: ``has_many :contact_subscriptions, class_name: 'Unidom::Contact::ContactSubscription', as: :subscriber``
|
@@ -4,19 +4,18 @@ class Unidom::Contact::EmailAddress < ActiveRecord::Base
|
|
4
4
|
|
5
5
|
self.table_name = 'unidom_email_addresses'
|
6
6
|
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
include Unidom::Contact::Concerns::AsContact
|
9
|
+
|
7
10
|
validates :personalized_name, presence: true, length: { in: 1..self.columns_hash['personalized_name'].limit }
|
8
11
|
validates :full_address, presence: true, length: { in: 4..self.columns_hash['full_address'].limit }, uniqueness: true
|
9
12
|
validates :local_part, presence: true, length: { in: 1..self.columns_hash['local_part'].limit }
|
10
13
|
validates :domain_part, presence: true, length: { in: 2..self.columns_hash['domain_part'].limit }
|
11
14
|
|
12
|
-
has_many :contact_subscriptions, class_name: 'Unidom::Contact::ContactSubscription', as: :contact
|
13
|
-
|
14
15
|
scope :full_address_is, ->(full_address) { where full_address: full_address }
|
15
16
|
scope :local_part_is, ->(local_part) { where local_part: local_part }
|
16
17
|
scope :domain_part_is, ->(domain_part) { where domain_part: domain_part }
|
17
18
|
|
18
|
-
include Unidom::Common::Concerns::ModelExtension
|
19
|
-
|
20
19
|
before_validation do
|
21
20
|
self.full_address.strip!
|
22
21
|
self.personalized_name = self.full_address if self.personalized_name.blank?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-contact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -40,6 +40,8 @@ files:
|
|
40
40
|
- app/assets/stylesheets/unidom/contact/application.css
|
41
41
|
- app/controllers/unidom/contact/application_controller.rb
|
42
42
|
- app/helpers/unidom/contact/application_helper.rb
|
43
|
+
- app/models/unidom/contact/concerns/as_contact.rb
|
44
|
+
- app/models/unidom/contact/concerns/as_subscriber.rb
|
43
45
|
- app/models/unidom/contact/contact_subscription.rb
|
44
46
|
- app/models/unidom/contact/email_address.rb
|
45
47
|
- app/views/layouts/unidom/contact/application.html.erb
|