Module: EffectiveClassifiedsClassifiedWizard
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/effective_classifieds_classified_wizard.rb
Overview
EffectiveClassifiedsClassifiedWizard
Mark your owner model with effective_classifieds_classified_wizard to get all the includes
Defined Under Namespace
Modules: Base, ClassMethods
Instance Method Summary
collapse
Instance Method Details
#assign_pricing ⇒ Object
150
151
152
153
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 150
def assign_pricing
raise('to be implemented by including class')
end
|
#build_classified ⇒ Object
146
147
148
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 146
def build_classified
classifieds.build(owner: owner)
end
|
#checkout_required? ⇒ Boolean
134
135
136
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 134
def checkout_required?
required_steps.include?(:billing) && required_steps.include?(:checkout)
end
|
#classified ⇒ Object
142
143
144
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 142
def classified
classifieds.first
end
|
#classified! ⇒ Object
After the configure Classified step
156
157
158
159
160
161
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 156
def classified!
assign_pricing() if classified.present?
raise('expected classified to have a price') if classified.price.blank?
save!
end
|
#done? ⇒ Boolean
130
131
132
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 130
def done?
submitted?
end
|
#in_progress? ⇒ Boolean
126
127
128
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 126
def in_progress?
draft?
end
|
#no_checkout_required? ⇒ Boolean
138
139
140
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 138
def no_checkout_required?
required_steps.exclude?(:billing) && required_steps.exclude?(:checkout)
end
|
#summary! ⇒ Object
This is the review/summary step. Last one if we’re not doing checkout
164
165
166
167
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 164
def summary!
return submit! if no_checkout_required?
save!
end
|
#to_s ⇒ Object
122
123
124
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 122
def to_s
model_name.human
end
|