ユーザーにプロファイルを完了するためにさまざまな手順を実行してもらいたいので、Devise で Wicked gem を実装しようとしています。まったくの初心者なので、何が問題なのか教えていただけると助かります。
私が得ているエラーはこれで、「個人」から「スタイル」のステップを続行しようとすると表示されます。データの保存に問題があると思います:
NoMethodError in OnboardingController#update
undefined method `attributes' for nil:NilClass
**@user.attributes(user_params)**
これらは私の登録およびオンボーディング コントローラーです。
class RegistrationsController < Devise::RegistrationsController
protected
def after_sign_up_path_for(resource)
'/onboarding/personal'
end
def after_update_path_for(resource)
registration_steps_path
end
def new
super
end
def create
super
end
def update
super
end
def update_resource(resource, params)
if resource.encrypted_password.blank? # || params[:password].blank?
resource.email = params[:email] if params[:email]
if !params[:password].blank? && params[:password] == params[:password_confirmation]
logger.info "Updating password"
resource.password = params[:password]
resource.save
end
if resource.valid?
resource.update_without_password(params)
end
else
resource.update_with_password(params)
end
end
end
と
class OnboardingController < ApplicationController
include Wicked::Wizard
steps :personal, :stylefirst
def show
@user = current_user
render_wizard
end
def update
@user = current_user
@user.attributes(user_params)
render_wizard @user
end
end