记录未保存在Heroku上,但正在开发中



我有一个功能,可以创建一个新的Contract对象,并在订阅请求获得批准时保存它。它在Subscription更新操作中被调用,并被提取到它自己的类中,而不是位于Model或Controller中。

在Heroku上,它在日志中显示了500,但没有提供有关该问题的消息。其他代码行继续运行。

完整代码块:

#Check to see the status of the subscription and that all of the checks have been completed
        if @subscription.Approved == "In Review" or @subscription.Approved == "Pending" && @subscription.CompanyNameCheck == "Approved" &&  @subscription.CompanyAddressCheck == "Approved" &&  @subscription.CompanyVATCheck == "Approved" && @subscription.CompanyKVKNumberCheck == "Approved" && @subscription.KVKCheck == "Approved" && @subscription.IDCheck == "Approved"
          #If everything is approved, then set the Subscription to approved and set the date
           @subscription.Approved = "Approved"
           @subscription.AcceptDate = Date.current
           @subscription.save!
           # Create a contract for the subscription
           @company = Company.find(@subscription.company_id)
           @contract = Contract.new(:company_id => @company.id, :subscription_type => @subscription.product.name, :company_type => @company.legal_entity, :subscription_id => @subscription.id, :CompanyName => @company.name) 
           @contract.save! 
           EventMailer.subscription_contract(@subscription, @contract).deliver
        end

未执行的行:

       @company = Company.find(@subscription.company_id)
       @contract = Contract.new(:company_id => @company.id, :subscription_type =>      @subscription.product.name, :company_type => @company.legal_entity, :subscription_id => @subscription.id, :CompanyName => @company.name) 
       @contract.save! 
       EventMailer.subscription_contract(@subscription, @contract).deliver

Heroku日志:

    2014-10-27T08:31:27.296463+00:00 heroku[router]: at=info method=GET path="/subscriptions/8/edit" host=tso.herokuapp.com request_id=a7ba490f-31fd-49ef-b282-3d65e978cab6 fwd="213.127.222.82" dyno=web.1 connect=1ms service=530ms status=200 bytes=10399
    2014-10-27T08:31:38.053338+00:00 heroku[router]: at=info method=POST path="/subscriptions/8" host=tso.herokuapp.com request_id=2f51d682-8d10-4709-9390-b1eb6d724144 fwd="213.127.222.82" dyno=web.1 connect=1ms service=233ms status=500 bytes=1543

您需要将gem'rails_12factor'添加到您的Gemfile中。使用此链接heroku设置

您可以尝试使用Logentries来尝试扩展错误消息或尝试添加rails_12factor gem

最新更新