4

WickedWizard gem を含むコントローラーに安静でないメソッドを含めることはできますか?

コントローラ:

class Books::BookUpdateController < ApplicationController

  include Wicked::Wizard
  steps :title_step,  :ai_archive_step, :ai_override_step #etc

   def show
      ...
   end

   def update
      ...
   end

   def waterfall
      ...# loads of code to set up instance variables in the view, which I don't want to have to include in the normal show action for all the wizard steps. 
   end
end

ルート:

resources :book_update do     
  member do
    get 'waterfall'
    ... and others 
  end
end

バージョン 1 以前の gem では安静でないアクションが許可されますが、この PRを解決するためのこのコミットではステップ名が強制されます。このルートに行く際の私のエラー はhttp://localhost:3000/book_update/3949/waterfall

Wicked::Wizard::InvalidStepError in Books::BookUpdateController#waterfall

The requested step did not match any steps defined for this controller.

新しいコントローラーを起動して、そこに安らかなアクションを押し込む必要があると思いますが、代替手段は素晴らしいでしょう.

4

1 に答える 1

9

以下を追加する必要があります。

skip_before_filter :setup_wizard, only: :waterfall

あなたの邪悪なコントローラーで

于 2014-01-14T15:16:57.340 に答える