Herokuで作成された予約管理アプリのバージョンアップを行っています。
rails6へバージョンアップをして、動作を確認しておりましたところ特定の画面で、下記のエラーが発生しました。
ActionView::Template::Error (undefined method `company' for nil:NilClass): 27: %td{title: charge.summary} 28: - if charge.payee.is_system_provider? 29: %small 30: = charge.service_contract.company.name 31: = ":" 32: = truncate(charge.summary) 33: - else app/views/dealer/charges/_list.html.haml:30 app/views/dealer/charges/_list.html.haml:16 app/views/dealer/charges/index.html.haml:24
同様の質問を拝見しまして、pryを使ってコンソールより原因を確認しようとしましたが、Herokuのrails consoleではbinding.pryを設置した場所の開き方がわかりませんでした。
私のPCはWindowsでtherubyracerをインストールできないことから、ローカルでのデバッグができない状態です。
原因や原因を探す方法などご存じの方がいらっしゃいましたら、お力をお貸しいただけると幸いです。
何卒宜しくお願い致します。
以下エラー発生のファイル(_list.html.haml)
haml
1- model_class = Charge 2 3- if charges.count > 0 4 %table.table.table-striped 5 %thead 6 %tr 7 %th.index{width: "50px"}= hname(model_class, :id) 8 %th.index{width: " 80px"}= hname(model_class, :amount) 9 %th.index{width: "120px"}= hname(model_class, :accurued_on) 10 %th.index{width: "120px"} 11 = hname(model_class, list_type == :debts ? :payee_id : :payer_id) 12 %th.index{width: "240px"}= hname(model_class, :summary) 13 %th.index{width: "50px"}= hname(model_class, :description) 14 %th 15 %tbody 16 - charges.each do |charge| 17 %tr 18 %td.index= charge.id 19 %td.currency{title: "税込み: %s" % yen(charge.amount_with_ctax)} 20 = yen(charge.amount) 21 %td.index 22 = l(charge.accurued_on) if charge.accurued_on 23 - if list_type == :debts 24 %td.index= charge.payee.name if charge.payee 25 - else 26 %td.index= charge.payer.name if charge.payer 27 %td{title: charge.summary} 28 - if charge.payee.is_system_provider? 29 %small 30 = charge.service_contract.company.name 31 = ":" 32 = truncate(charge.summary) 33 - else 34 = truncate(charge.summary) 35 %td{title: charge.description} 36 = "..." unless charge.description.blank? 37 %td.index 38 - if charge.amount > 0 39 = link_to t("bill.title"), {action: "bill", id: charge}, 40 class: "btn btn-link", target: "_blank" 41 42 - if list_type == :credits 43 = link_to t("dealer.charges.edit.title"), 44 edit_dealer_charge_path(charge), 45 class: "btn btn-link" 46 47- else 48 .muted Not found. 49
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。