rsvp 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/models/rsvp/family.rb +1 -3
- data/app/models/rsvp/invitation.rb +1 -2
- data/app/models/rsvp/person.rb +9 -0
- data/app/models/rsvp/salutation/husband_wife_and_family.rb +1 -1
- data/app/models/rsvp/salutation/single_female_and_guest.rb +1 -1
- data/app/models/rsvp/salutation/single_male_and_guest.rb +1 -1
- data/app/models/rsvp/salutation/widow_and_family.rb +1 -1
- data/app/models/rsvp/salutation/widower_and_family.rb +1 -1
- data/app/models/rsvp/salutation_mixin.rb +18 -2
- data/db/migrate/20140106042630_create_rsvp_families.rb +1 -0
- data/db/migrate/20140106042845_create_rsvp_invitations.rb +1 -0
- data/lib/rsvp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTcxN2E0MmZmOGM1MTcwYTVkOTY1ODdjYTczYWY5ZTdmMzUxMTNjOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTAzZGVlYjkyZmY2ZjZjMGVkZTBmNDcyODBhZGM4OGM2N2VlYzM0YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzlhNzMyOTQxMzczNWExYWY0ZGQ3OWJjZDRmY2EzMGQwOTZhMWE3ZmExZDVi
|
10
|
+
NTMxY2RjNDI2YTQwOGVkYmQwYjhiYjlkMzZjNzI4M2NjNzMwYTg1OWI4MmY2
|
11
|
+
MzkxZTQ4ZmE4Y2ZjOTM1ZmFkNGM1Zjg0MTBlMWFjY2ZhNGJmNTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjA0OGEyZjgxNjA3ZmU2ZThjYTY4ZTgxZmNjODI1N2EyZWFmMzVlMTkzNmFk
|
14
|
+
NzYyOWU1Njk2MWYwZmNmYTcxZDFkNzU4YTNmNjg0NDExYjk3YmRlN2ZlYWM5
|
15
|
+
M2NjY2IzYWMwMDk1NGM0YTc1YjNiZmRhNTljOWY4NWRiNWE2YTk=
|
data/app/models/rsvp/family.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
module Rsvp
|
2
2
|
class Family < ActiveRecord::Base
|
3
|
-
attr_accessible :
|
3
|
+
attr_accessible :city, :postal_code, :state, :street_1, :street_2
|
4
4
|
has_many :invitations
|
5
5
|
has_many :members
|
6
6
|
has_many :people, :through => :members
|
7
7
|
|
8
|
-
validates :salutation_type, :presence => true
|
9
|
-
|
10
8
|
include SalutationMixin
|
11
9
|
|
12
10
|
def family
|
@@ -4,9 +4,8 @@ module Rsvp
|
|
4
4
|
belongs_to :family
|
5
5
|
has_many :responses
|
6
6
|
|
7
|
-
validates :salutation_type, :presence => true
|
8
7
|
validates :rsvp_code, :presence => true, :uniqueness => true, :length => { is: 7 }
|
9
|
-
validates :total_invited, :inclusion => 1..10
|
8
|
+
validates :total_invited, :presence => true, :inclusion => 1..10
|
10
9
|
|
11
10
|
include SalutationMixin
|
12
11
|
|
data/app/models/rsvp/person.rb
CHANGED
@@ -4,6 +4,7 @@ module Rsvp
|
|
4
4
|
has_many :memberships, :class_name => "Member"
|
5
5
|
has_many :families, :through => :memberships
|
6
6
|
|
7
|
+
validates :gender_type, :presence => true
|
7
8
|
validates :first_name, :presence => true
|
8
9
|
validates :last_name, :presence => true
|
9
10
|
|
@@ -15,5 +16,13 @@ module Rsvp
|
|
15
16
|
def self.adult_females
|
16
17
|
where("gender_type = ?", Gender::AdultFemale.to_s)
|
17
18
|
end
|
19
|
+
|
20
|
+
def gender_type=(klass)
|
21
|
+
write_attribute(:gender_type, klass.to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
def gender_type
|
25
|
+
read_attribute(:gender_type).try(:constantize)
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
@@ -1,5 +1,13 @@
|
|
1
1
|
module Rsvp
|
2
2
|
module SalutationMixin
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
attr_accessible :salutation_type, :salutation
|
6
|
+
after_save :generate_salutation
|
7
|
+
|
8
|
+
validates :salutation_type, :presence => true
|
9
|
+
end
|
10
|
+
|
3
11
|
def salutation_type=(klass)
|
4
12
|
write_attribute(:salutation_type, klass.to_s)
|
5
13
|
end
|
@@ -8,8 +16,16 @@ module Rsvp
|
|
8
16
|
read_attribute(:salutation_type).try(:constantize)
|
9
17
|
end
|
10
18
|
|
11
|
-
def
|
12
|
-
|
19
|
+
def generate_salutation
|
20
|
+
salutation = read_attribute(:salutation)
|
21
|
+
if salutation.blank? && salutation_type.present?
|
22
|
+
begin
|
23
|
+
write_attribute(:salutation, salutation_type.try(:new, family).to_s)
|
24
|
+
self.save(callbacks: false)
|
25
|
+
rescue
|
26
|
+
# Trap exceptions thrown due to incomplete data structures
|
27
|
+
end
|
28
|
+
end
|
13
29
|
end
|
14
30
|
end
|
15
31
|
end
|
data/lib/rsvp/version.rb
CHANGED