1

Ruby on Rails + デバイスベースのアプリケーションでサインアップ/登録フォームに 2 つのパラメーターを追加するために、こちらの手順に従っています: http://devise.plataformatec.com.br/#getting-started/strong-parameters

私のコントローラーは簡単です:

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  before_filter :configure_permitted_parameters, if: :devise_controller?

  before_filter :authenticate_user!

  protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) << :username
  end
end

私が得ているエラーは次のとおりです。

NoMethodError in Devise::SessionsController#new 

undefined method `<<' for {}:ActionController::Parameters

間違ったバージョンの Devise などを使用していますか? Gemfilegem 'devise', :git => 'https://github.com/plataformatec/devise', :branch => 'v3.0'で指定しましたが、他に異常はありません。

4

1 に答える 1