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