0

(createメソッドの)Registrationコントローラーに次のコードがあります。

respond_to do |format|
  if discount_code && invalid_discount_code
    flash[:notice] = error_notification
    format.html { render action: "new" }
  elsif already_registered
    flash.now[:error] = error_notification
    format.html { redirect_to root_url }
  elsif @user.save
    events_history_hash = JSON.parse(@user.events_history)
    @user.skip_confirmation!
    sign_in @user
    if events_history_hash[Current_event_id.to_s]["payment"] && events_history_hash[Current_event_id.to_s]["payment"] == 0
      flash[:notice] = "Your complimentary registration for this event has been accepted."
      format.html { redirect_to root_url }
    elsif auto_approve
      payment = extract_payment_from_events_history_json(@user.events_history)
      format.html { redirect_to new_stripe_payment_path(:registration_payment => payment) }
    else
      EventMailer.send_email_to_admins_to_process_invite_request(current_user).deliver
      flash[:notice] = INVITE_REQUEST_RECEIVED
      format.html { redirect_to root_url }
    end
  else
    format.html { render action: "new" }
    format.json { render json: @user.errors, status: :unprocessable_entity }
  end
end

コードは開発環境(MACに対してローカル)で完全に正常に実行され、auto_approveがtrueの場合は支払いページにリダイレクトされますが、コードをテストサーバーにアップロードすると、常に実行されます。

EventMailer.send_email_to_admins_to_process_invite_request(current_user).deliver

auto_approveがtrueに設定されていても。テストサーバーでコンソールを実行して、これを確認しました。他に何を探すべきですか?

おそらくハック:

これはおそらくハックですが、問題は修正されました。test.rbで、config.serve_static_assetsの値をfalseからtrueに変更しました(デフォルトでは、test.rbとproduction.rbではfalseに設定されていましたが、development.rbではtrueに設定されていました)

config.serve_static_assets = true
4

1 に答える 1

0

どのように、どこauto_approveに設定されていますか?このテスト サーバーは運用環境で実行されていますか?

于 2012-09-26T20:54:21.080 に答える