Class: MembershipCompJob
- Inherits:
-
Struct
- Object
- Struct
- MembershipCompJob
- Defined in:
- app/models/membership_comp_job.rb
Constant Summary collapse
- QUEUE =
"comp"
Instance Attribute Summary collapse
-
#membership_comp ⇒ Object
Returns the value of attribute membership_comp.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#membership_comp ⇒ Object
Returns the value of attribute membership_comp
1 2 3 |
# File 'app/models/membership_comp_job.rb', line 1 def membership_comp @membership_comp end |
Class Method Details
.enqueue(membership_comp) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/membership_comp_job.rb', line 4 def self.enqueue(membership_comp) job = MembershipCompJob.new # # Weird Rails/DJ bug where calling validate on membership_comp caused the errors # to hang around. DJ would choke on when Syck tried to deserialize the errors attr # The error message was horrible and misleading (uninitialized constant Syck::Syck) # # It's probably because we're including ActiveModel::Validations on MembershipComp # membership_comp.clear_errors job.membership_comp = membership_comp if run_now? job.perform else Delayed::Job.enqueue job, :queue => QUEUE end end |
.run_now? ⇒ Boolean
24 25 26 |
# File 'app/models/membership_comp_job.rb', line 24 def self.run_now? Rails.env.test? end |
Instance Method Details
#perform ⇒ Object
28 29 30 |
# File 'app/models/membership_comp_job.rb', line 28 def perform membership_comp.perform end |