1

Stripe を使用して支払いフォームを作成できるように、RegistrationsController をサブクラス化しました。create メソッドに Stripe コードを挿入しました。サインアップすると、Stripe の顧客が問題なく作成されます。ただし、登録が完了してもログインできず、ログインできないためユーザーが作成されません。

コードは以下のとおりです (関連性がないように思われるため、Stripe コードは省略しましたが、必要に応じて投稿できます)。

    build_resource
resource.role = params[:selectplan]
resource.admin = false 
resource.customer_id = customer.id
if resource.save
  Notifier.signup_email(@user).deliver
  if resource.active_for_authentication?
    set_flash_message :notice, :signed_up if is_navigational_format?
    sign_in(resource_name, resource)
    respond_with resource, :location => after_sign_up_path_for(resource)
  else
    set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
    expire_session_data_after_sign_in!
    respond_with resource, :location => after_inactive_sign_up_path_for(resource)
  end
else
  clean_up_passwords resource
  respond_with resource
end  
4

1 に答える 1

1

Rails 4とDeviseがサポートしていないattr_accessibleをまだ使用していたため、リソースは保存されませんでした。強力なパラメーターを使用するように切り替えたところ、再び正しく機能するようになりました。

于 2013-10-28T11:03:36.777 に答える