问题可能不那么复杂,但我很困惑.我有两个用户,即学生和教师,对于那些我想要单独的模型,控制器和视图.我希望老师使用/t/sign_up和学生/s/sign_up.我正在使用设计进行身份验证,我知道这是可能的,因为这是主动管理工作的方式.
我必须使用多步表单来创建作业,为此我使用了 wicked gem。
assignment_steps_controller.rb
class Teacher::AssignmentStepsController < ApplicationController
include Wicked::Wizard
steps :initial_information, :choose_questions, :order_questions, :confirmation
def show
...
render_wizard
end
def update
...
redirect_to next_wizard_path
end
end
Run Code Online (Sandbox Code Playgroud)
assignment_controller.rb
class Teacher::AssignmentsController < ApplicationController
def new
@assignment = current_teacher.assignments.new
redirect_to teacher_assignment_steps_path(:initial_infomation)
end
def create
render :new
end
end
Run Code Online (Sandbox Code Playgroud)
现在创建作业的效果很好。但我的问题是我将如何使用相同的多步骤表单来编辑作业?