Class: SponsoredDonationKit
- Inherits:
-
Kit
- Object
- ActiveRecord::Base
- Kit
- SponsoredDonationKit
show all
- Defined in:
- app/models/kits/sponsored_donation_kit.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Kit
#abilities, #activatable?, activate, activation_requirements, acts_as_kit, #admin_approvable?, admin_approval_requirements, admin_approve, #alternatives, #approvable?, approval_requirements, approve, #has_alternatives?, mailchimp, pad_with_new_kits, #requirements_met?, subklasses, visible, when_active
#record_activation, #record_approval
Class Method Details
.setup_state_machine ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 49
def self.setup_state_machine
state_machine do
state :fresh
state :pending, :enter => :on_pending
state :activated, :enter => :on_activation
state :cancelled
event :activate do
transitions :from => [:fresh, :pending], :to => :activated, :guard => :activatable?
end
event :activate_without_pending do
transitions :from => [:fresh, :pending, :cancelled], :to => :activated
end
end
end
|
Instance Method Details
#connected? ⇒ Boolean
33
34
35
36
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 33
def connected?
errors.add(:requirements, "You need to connect to your Fractured Atlas Membership to active this kit.") unless organization.connected?
organization.connected?
end
|
#exclusive? ⇒ Boolean
38
39
40
41
42
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 38
def exclusive?
exclusive = !organization.kits.where(:type => alternatives.collect(&:to_s)).any?
errors.add(:requirements, "You have already activated a mutually exclusive kit.") unless exclusive
exclusive
end
|
#friendly_name ⇒ Object
25
26
27
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 25
def friendly_name
"Sponsored Donations"
end
|
21
22
23
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 21
def
organization.
end
|
#has_website? ⇒ Boolean
44
45
46
47
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 44
def has_website?
errors.add(:requirements, "You need to specify a website for your organization.") unless !organization.website.blank?
!organization.website.blank?
end
|
#pitch ⇒ Object
29
30
31
|
# File 'app/models/kits/sponsored_donation_kit.rb', line 29
def pitch
"Contact [email protected] to learn about Fiscal Sponsorship through Fractured Atlas."
end
|