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

时间:2014-10-27 08:38:31

标签: ruby-on-rails ruby-on-rails-4 heroku

我有一个funciton创建一个新的Contract对象,并在批准订阅请求时保存它。它在订阅更新操作中被调用,并被提取到它自己的类中,而不是坐在模型或控制器中。

在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 Logs:

    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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

您需要将 gem'rail_12factor'添加到您的Gemfile中。使用此链接heroku setup