正在发生奇怪的事情。当我运行下面的代码时,出现错误
Input/output error @ io_write - <STDOUT>
由于仅在运行此代码时发生,我认为这与代码的这一部分有关,但是请告知我是否需要更多信息。
模型
def total_extra_guest_price(reservation)
sum_guest = 0
sum_amount_guests = 0
age_table_list = []
reservation.reservation_extra_guests.each do |guest|
sum_amount_guests += guest.extra_guest_quantity
end
# persons included vs persons reservation
#if more persons
if reservation.room.room_category.persons_included < sum_amount_guests
#count number of too many persons
extra_persons = sum_amount_guests - reservation.room.room_category.persons_included
# iterate to get res_guest.guest.age_table
reservation.reservation_extra_guests.each do |extra_guest_item|
age_table_list << extra_guest_item.extra_guest.age_table
end
#rank age_tables
age_table_list=age_table_list.sort_by{|item| item['rank']}.reverse!
#while number_to_many persons != 0
while extra_persons != 0
reservation.reservation_extra_guests.each do |res_extra_guest|
age_table_list.each do |age_table|
while res_extra_guest.extra_guest.age_table == age_table && res_extra_guest.extra_guest_quantity != 0
# binding.pry
# binding.pry
(reservation.arrival...reservation.departure).each do |date|
res_extra_guest.extra_guest.extra_guest_prices.each do |price|
if (price.start_date..price.end_date).include? date
sum_guest += price.price
end
end
end
res_extra_guest.extra_guest_quantity -= 1
extra_persons -= 1
end
end
end
end
end
end
答案 0 :(得分:0)
这是Rails / Puma程序的问题。
您也可以尝试以下技巧:
ps aux | grep puma
示例输出:
myname 77921 0.0 0.0 2433828 1972 s000 R+ 11:17AM 0:00.00 grep puma
myname 67661 0.0 2.3 2680504 191204 s002 S+ 11:00AM 0:18.38 puma 3.11.2 (tcp://localhost:3000) [my_proj]
然后:
kill -9 67661