Ruby on rails 4 动态步骤顺序

Ruby on rails 4 动态步骤顺序,ruby-on-rails-4,wicked-gem,Ruby On Rails 4,Wicked Gem,我正试图根据上一个选择中的选择来改变邪恶向导中步骤的顺序 所以现在我有了所有的步骤: class WWTestController < ApplicationController include Wicked::Wizard steps :first_page,:optional_page,:second_page def show @event_object = EventObject.find(params[:event_object_id]) r

我正试图根据上一个选择中的选择来改变邪恶向导中步骤的顺序

所以现在我有了所有的步骤:

class WWTestController < ApplicationController
  include Wicked::Wizard
  steps :first_page,:optional_page,:second_page

   def show
     @event_object = EventObject.find(params[:event_object_id])

     render_wizard
   end

   def update
     @event_object = EventObject.find(params[:event_object_id])
     @event_object.update_attributes(event_object_params)

     render_wizard @event_object
   end

   private

   def event_entry_params
    params.fetch(:event_object, {}).permit(:choice_a)
   end

end
class WWTestController
我只想包括步骤:可选页面,如果他们的选择:选择a等于2。我已经尝试过各种配置,但我遇到的真正问题是,如果它们返回到:第一页,并更改步骤,则并不总是正确的。我相信有人对此有一个很好的方法,任何帮助都将不胜感激

  def show
    @event_object = EventObject.find(params[:event_object_id])

    # Extra logic based on flow steps - when to skip sth.
    case step
    when :optional_page
      skip_step unless @event_object.choice_a == 2
    end

    render_wizard
  end