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
140
141
142
143
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 140
def assign_pricing
raise('to be implemented by including class')
end
|
#build_classified ⇒ Object
136
137
138
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 136
def build_classified
classifieds.build(owner: owner)
end
|
#checkout_required? ⇒ Boolean
124
125
126
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 124
def checkout_required?
required_steps.include?(:billing) && required_steps.include?(:checkout)
end
|
#classified ⇒ Object
132
133
134
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 132
def classified
classifieds.first
end
|
#classified! ⇒ Object
After the configure Classified step
146
147
148
149
150
151
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 146
def classified!
assign_pricing() if classified.present?
raise('expected classified to have a price') if classified.price.blank?
save!
end
|
#done? ⇒ Boolean
120
121
122
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 120
def done?
submitted?
end
|
#in_progress? ⇒ Boolean
116
117
118
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 116
def in_progress?
draft?
end
|
#no_checkout_required? ⇒ Boolean
128
129
130
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 128
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
154
155
156
157
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 154
def summary!
return submit! if no_checkout_required?
save!
end
|
#to_s ⇒ Object
112
113
114
|
# File 'app/models/concerns/effective_classifieds_classified_wizard.rb', line 112
def to_s
model_name.human
end
|