加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Wicked Wizard控制器中的非静止动作

发布时间:2020-12-17 03:55:47 所属栏目:百科 来源:网络整理
导读:你可以在包含WickedWizard gem的控制器中使用非restful方法吗? 控制器: class Books::BookUpdateController ApplicationController include Wicked::Wizard steps :title_step,:ai_archive_step,:ai_override_step #etc def show ... end def update ... e
你可以在包含WickedWizard gem的控制器中使用非restful方法吗?

控制器:

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允许非静态操作,但this commit解决this 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.

我想我应该激发一个新的控制器并将非静止的动作塞进那里,但替代方案会很棒.

解决方法

你需要添加:

skip_before_filter :setup_wizard,only: :waterfall

在你邪恶的控制器

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读