【问题标题】:Got error from devise user and wicked rails gem从设计用户和 wicked rails gem 那里得到错误
【发布时间】:2014-09-24 04:46:50
【问题描述】:

使用邮箱和密码注册后浏览器出错。

class UserStepsController < ApplicationController
 steps :personal

 def show
  @user = current_user
  render_wizard
 end

def update
  @user = current_user
  @user.update_attributes(user_params)
  render_wizard @user
end

def finish_wizard_path
 flash[:notice] = "You have successfully Registered With The Wizard."
 user_path(current_user)
end

private

 def user_params
  params.require(:user).permit(:first_name, :last_name, :degree_level, :role, :email,  :password )
 end

end

RegistrationsController <:registrationscontroller>

class RegistrationsController < Devise::RegistrationsController
 def new
  super
 end

 def create
  super
 end

 protected
    def after_sign_up_path_for(resource)
        '/user_steps'
    end
end

我已经添加了路由资源 :user_steps, devise_for :users, :controllers => { :registrations => "registrations" }

我的设计/注册/新

  <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
  <%= f.input :email, required: true, autofocus: true %>
  <%= f.input :password, required: true %>
  <%= f.input :password_confirmation, required: true %>
 </div>
 <div class="form-actions">
 <%= f.button :submit, "Sign up" %>
 </div>
 <% end %>
 <%= render "devise/shared/links" %>

添加了personal.html.erb名字、姓氏和学位等级

<%= form_for(@user, :url => wizard_path, :method => :put) do |f|%>
 <%= f.text_field :first_name  %>
 <%= f.text_field :last_name %>
 <%= f.text_field :degree_level %>
<%= f.submit 'submit', :class => "btn btn-primary" %>
<%end%>

添加的用户模型验证存在。 使用电子邮件和密码注册后显示此错误

错误信息是请查看以下问题:

【问题讨论】:

  • error msg 是什么?,我可以在UserStepsController 中看到index 操作你有index 视图吗?
  • 你的代码工作了吗?你在哪里创建personal.html.erb?我的意思是在哪个文件夹中。

标签: ruby-on-rails ruby ruby-on-rails-4 devise wicked-gem


【解决方案1】:

对不起,我想添加include Wicked::Wizard

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多