Ruby on rails 没有与[POST]匹配的路由“/user\u步骤/profile”
尝试使用邪恶宝石创建两步向导。 每个步骤适用于不同的模型。首先是用户模型,其次是概要文件。用户有许多配置文件 我能够成功地完成第一步。我要求他们添加电子邮件的“个人”页面。但是,当我尝试创建第二步时,我得到:Ruby on rails 没有与[POST]匹配的路由“/user\u步骤/profile”,ruby-on-rails,Ruby On Rails,尝试使用邪恶宝石创建两步向导。 每个步骤适用于不同的模型。首先是用户模型,其次是概要文件。用户有许多配置文件 我能够成功地完成第一步。我要求他们添加电子邮件的“个人”页面。但是,当我尝试创建第二步时,我得到: No route matches [POST] "/user_steps/profile" 我要做的是创建当前的_user.profiles.new 这是我的控制器代码: class UserStepsController < ApplicationController inc
No route matches [POST] "/user_steps/profile"
我要做的是创建当前的_user.profiles.new
这是我的控制器代码:
class UserStepsController < ApplicationController
include Wicked::Wizard
steps :personal, :profile
def show
@user = current_user
case step
when :profile
@profile = current_user.profiles.new
end
render_wizard
end
def update
@user = current_user
case step
when :personal
@user.update_attributes(personal_params)
when :profile
@profile = current_user.profiles.new(profile_params)
if @profile.save
redirect_to root_url
else
redirect_to :back
end
end
render_wizard @user
end
private
def personal_params
params.require(:user).permit(:email)
end
def profile_params
params.require(:profile).permit(:followers)
end
end
配置文件表单很简单,如下所示:
<%= form_for @profile, url: wizard_path do |f| %>
<%= f.text_field :followers %>
<%= f.button %>
<% end %>