I have a rather complicated model with many fields, associations has_many, images added image_column, etc.
has_many
image_column
A new object will be added using a multi-page form (8 steps). How can I perform validation and distribution between these steps?
I think it validation_groupcan be useful for determining validations for each step, but what about the overall design?
validation_group
Presenter (Jay Fields Rails: Presenter Pattern) / .
, . step_1, step_2, , . , , , 3 1. , , , , . , , ; 2 , 3, step_3, step_2 , 2 .
step_1
step_2
step_3
, 1 , "" , 0, 1 .
(, 3, 5).
, 'name' 'email'. step_2 , params[:name] params[:email] . , . 2 "" "". step_3 , params[:age] params[:gender] , , 1, URL 3 . .
params[:name]
params[:email]
params[:age]
params[:gender]
class Campaign < ActiveRecord::Base with_options(:if => lambda { |campaign| campaign.on_or_past_step(:spam_can) }) do |spam_can| spam_can.validates_associated :spam_can spam_can.validates_presence_of :spam_can end def on_or_past_step : : end end
, , . AASM, , . , , . , ?