gpt4 book ai didi

ruby-on-rails - Wicked Wizard Controller 中的非静态操作

转载 作者:行者123 更新时间:2023-12-04 03:53:57 25 4
gpt4 key购买 nike

您可以在包含 WickedWizard gem 的 Controller 中使用非 Restful 方法吗?

Controller :

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

gem 1 及更低版本允许非静态操作,但 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.

我想我应该启动一个新的 Controller 并将非 Restful 操作塞进那里,但替代方案会很棒。

最佳答案

您需要添加:

skip_before_filter :setup_wizard, only: :waterfall

在你邪恶的 Controller 中

关于ruby-on-rails - Wicked Wizard Controller 中的非静态操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21116229/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com