我有一个异常被这段代码捕获,我无法查明错误。
def paypal_content
payment = {}
payment[:intent] = "sale"
payment[:payer] = { :payment_method => "paypal" }
payment[:redirect_urls] = { :return_url => "http://localhost:3000/payment/execute", :cancel_url => "http://localhost:3000"}
items = []
index = 0
@cart.items.each do |item|
items[index] = {}
items[index][:name] = item.title
items[index][:sku] = item.artist
items[index][:price] = item.price.to_s
items[index][:quantity] = "1"
items[index][:currency] = "CHF"
index++
end <--- this is line 109
item_list = {}
item_list[:items] = items
transactions = []
transactions[0] = {}
transactions[0][:item_list] = item_list
transactions[0][:amount] = { :total => @cart.total_price.to_s, :currency => "CHF"}
transactions[0][:description] = "from Larraby Blaine Esquire"
payment[:transactions] = transactions
return payment
end
错误是 home_controller.rb:109 语法错误,意外的keyword_end home_controller.rb:125:语法错误,意外的$end,期待keyword_end
如果我删除每个块都很好,所以我想我在块上犯了一个错误,但是什么错误??????