함수를 호출 할 때 다음 오류 로그가 표시됩니다. 해독을 도와주세요.루비 메소드 호출시 서버 오류 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