如何從一個如何從錯誤中搶救耙
未定義的方法
error in this code
for user in @users do
@customer = Stripe::Customer.retrieve(user.stripe_customer_token)
if @customer.subscription.nil?
elsif @customer.subscription.plan.id == 2
user.silver_reset
elsif @customer.subscription.plan.id == 3
user.gold_reset
end
end
我已經嘗試了簡單的救援電話搶救,但耙不喜歡它。
從錯誤中拯救的方法是什麼?
UPDATE:
我是這樣做
for user in @users do
@customer = Stripe::Customer.retrieve(user.stripe_customer_token)
rescue_from Exception => exception
# Logic
end
if @customer.subscription.nil?
elsif @customer.subscription.plan.id == 2
user.silver_reset
elsif @customer.subscription.plan.id == 3
user.gold_reset
end
end
的錯誤 /home/user/rails_projects/assignitapp/lib/tasks/daily.rake:25方式:語法錯誤,意想不到的keyword_rescue ,期望keyword_end 救援異常=>異常
瑞克0.9.2.2 滑軌3.2.5
你如何試圖拯救? –
「Rake不喜歡它」 - 您嘗試的代碼是什麼以及您獲得了哪些錯誤或行爲? –
添加了Henrique和Jordon要求提供的信息。 – Mab879