-1
當我調用一個函數時,我得到以下錯誤日誌; 請幫助解密它。調用方法ruby時出現服務器錯誤500
NoMethodError (undefined method `first' for #<Matching:0x0000000875a050>):
app/mailers/matching_mailer.rb:6:in `new_matchings_for_customer'
app/models/matching.rb:133:in `block in create_matchings_from_service'
app/models/matching.rb:126:in `each'
app/models/matching.rb:126:in `create_matchings_from_service'
app/models/matching.rb:30:in `process_matchings_for_service'
app/models/payments/subscription.rb:94:in `find_matchings'
app/models/payments/subscription.rb:85:in `after_create_actions'
app/controllers/contractors/subscriptions_controller.rb:51:in `subscribe'
app/controllers/contractors/subscriptions_controller.rb:19:in `create'
EDIT 1:
第一匹配郵包的幾行:
class MatchingMailer < ActionMailer::Base
default from: "\"Estimate My Project\" <[email protected]>"
def new_matchings_for_customer(matchings, customer_id)
@customer = Customer.find(customer_id)
@matchings = Matching.find(matchings)
@category = @matchings.first.emp_request.subcategory.category
unless @customer.email.empty?
mail(to: @customer.email, subject: "#{@category.name} estimate for project in #{@customer.zip_code.county.name}, #{@customer.zip_code.state.code} #{@customer.zip_code.code}")
else
self.message.perform_deliveries = false
end
end
:添加了我的匹配郵件行。 –
我現在更新了我的答案,我知道你的郵件... – spickermann