rsvp 0.0.2 → 0.1.0
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 +9 -2
- data/app/models/rsvp/invitation.rb +4 -1
- data/app/models/rsvp/salutation.rb +7 -3
- data/app/models/rsvp/salutation_mixin.rb +15 -0
- data/app/views/rsvp/response/index.html.erb +1 -1
- 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 +5 -5
- data/db/migrate/20140106043143_create_rsvp_salutations.rb +0 -10
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzJjZTZiYWZhYzI4YWI4YjQxMWM3Zjg1ZjE2YWRmOWUwNWFlZjE4Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjQ1MGVhZjg0ZDJmMjdmNWZhOWRmMmNiMTM3NWM2M2UxM2RjNTU2Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWM3ZDllNWUzOTRhMWQ1YmRkYzAzOWE1OGVjNzBmNmZlYjI5OTc2OTRkMzBh
|
10
|
+
OGYzNzBlYjU3MjJlMDUyNDY2Y2I1ZTVlMmUxNTY2NmU4OWE1MTI1NDQyMGUz
|
11
|
+
MGVjM2NmMWY1NTY1MDhhZjI2NGRhMDE1OTM4MDlhZjFkOGQ0ZDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODU1MTQ4ZTE4MDU4YTAxMDQ4ZDY3ZDVmNzVlNzkzNzkyNzUxOTJhZTFiNDFk
|
14
|
+
MTE5MjZiYjJhZDZlZWVhYTVlODE3ZTI5YjhlMDliZDFlN2Y5NTg3YmFhNzkz
|
15
|
+
MDViNDNmNWJiZGE2MWZiMGExY2Y4ZTJhYTFiMmU3YTBlOGY2MDg=
|
data/app/models/rsvp/family.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
module Rsvp
|
2
2
|
class Family < ActiveRecord::Base
|
3
|
-
attr_accessible :city, :postal_code, :state, :street_1, :street_2
|
3
|
+
attr_accessible :salutation_type, :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
|
+
include SalutationMixin
|
11
|
+
|
12
|
+
def family
|
13
|
+
self
|
14
|
+
end
|
8
15
|
end
|
9
16
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
module Rsvp
|
2
2
|
class Invitation < ActiveRecord::Base
|
3
|
-
attr_accessible :rsvp_code, :total_invited
|
3
|
+
attr_accessible :salutation_type, :rsvp_code, :total_invited
|
4
4
|
belongs_to :family
|
5
5
|
has_many :responses
|
6
6
|
|
7
|
+
validates :salutation_type, :presence => true
|
7
8
|
validates :rsvp_code, :presence => true, :uniqueness => true, :length => { is: 7 }
|
8
9
|
validates :total_invited, :inclusion => 1..10
|
9
10
|
|
11
|
+
include SalutationMixin
|
12
|
+
|
10
13
|
def total_invite_options
|
11
14
|
(1..total_invited).to_a
|
12
15
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Rsvp
|
2
|
-
class Salutation
|
3
|
-
|
4
|
-
|
2
|
+
class Salutation
|
3
|
+
attr_accessor :family
|
4
|
+
|
5
|
+
def initialize(family)
|
6
|
+
raise "Salutation class initialization requires a family to be passed." if family.nil?
|
7
|
+
@family = family
|
8
|
+
end
|
5
9
|
|
6
10
|
def template
|
7
11
|
raise "Template not implemented in subclass."
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Rsvp
|
2
|
+
module SalutationMixin
|
3
|
+
def salutation_type=(klass)
|
4
|
+
write_attribute(:salutation_type, klass.to_s)
|
5
|
+
end
|
6
|
+
|
7
|
+
def salutation_type
|
8
|
+
read_attribute(:salutation_type).try(:constantize)
|
9
|
+
end
|
10
|
+
|
11
|
+
def salutation
|
12
|
+
salutation_type.try(:new, family)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<% end %>
|
7
7
|
<% end %>
|
8
8
|
|
9
|
-
<p>Hi, <%= @invitation.family.salutation %>! Thank you for choosing to RSVP to our special day.</p>
|
9
|
+
<p>Hi, <%= @invitation.family.salutation.to_s %>! Thank you for choosing to RSVP to our special day.</p>
|
10
10
|
<p>Will you attend?</p>
|
11
11
|
|
12
12
|
<ul>
|
data/lib/rsvp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsvp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ricard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '1.3'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '1.3'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: debugger
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- app/models/rsvp/salutation/widow_and_family.rb
|
185
185
|
- app/models/rsvp/salutation/widower.rb
|
186
186
|
- app/models/rsvp/salutation/widower_and_family.rb
|
187
|
+
- app/models/rsvp/salutation_mixin.rb
|
187
188
|
- app/views/layouts/rsvp/application.html.erb
|
188
189
|
- app/views/rsvp/response/_show.html.erb
|
189
190
|
- app/views/rsvp/response/confirmation.html.erb
|
@@ -197,7 +198,6 @@ files:
|
|
197
198
|
- db/migrate/20140106042748_create_rsvp_members.rb
|
198
199
|
- db/migrate/20140106042845_create_rsvp_invitations.rb
|
199
200
|
- db/migrate/20140106043014_create_rsvp_responses.rb
|
200
|
-
- db/migrate/20140106043143_create_rsvp_salutations.rb
|
201
201
|
- lib/generators/rsvp/USAGE
|
202
202
|
- lib/generators/rsvp/views_generator.rb
|
203
203
|
- lib/rsvp.rb
|