大家早上好。
\n我试图理解下面的错误,但由于我是 Rails 新手,我不太明白。有人知道它可能是什么吗?
\n我在互联网上搜索但没有找到任何具体内容。
\n我在互联网上搜索过,但没有找到任何内容,如果有人看到或有链接,可以发送给我,我会看到。
\n如果您需要更多信息来提供帮助,请告诉我,我将编辑该帖子并添加它,我不知道是否还有其他内容我可以发布。
\n感谢您的帮助 !!
\n\n\xe2\x9e\x9c make up \ndocker-compose up\nStarting XXXXXX_postgres ... done\nStarting XXXXXX_mailcatcher ... done\nStarting XXXXXX_rails ... done\nAttaching to XXXXXX_mailcatcher, XXXXXX_postgres, XXXXXX_rails\nXXXXXX_mailcatcher | Starting MailCatcher\nXXXXXX_mailcatcher | ==> smtp://0.0.0.0:1025\nXXXXXX_postgres | \nXXXXXX_postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization\nXXXXXX_postgres | \nXXXXXX_mailcatcher | /usr/local/bundle/gems/thin-1.5.1/lib/thin/server.rb:104: warning: constant ::Fixnum is deprecated\nXXXXXX_postgres | 2022-01-21 11:02:46.949 UTC [1] LOG: starting PostgreSQL 12.8 (Debian 12.8-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 …Run Code Online (Sandbox Code Playgroud) 这两个点在 Rails 中意味着什么
有一个这样的函数:
def period
start_date..end_date
end
Run Code Online (Sandbox Code Playgroud)
它是什么?这会生成一个数组吗?我看到这个课程中使用了这个
class Booking < ApplicationRecord
# ... some code is skipped here for simplicity's sake
validate :validate_other_booking_overlap
def period
start_date..end_date
end
private
def validate_other_booking_overlap
other_bookings = Booking.all
is_overlapping = other_bookings.any? from |other_booking|
period.overlaps?(other_booking.period)
end
errors.add(:overlaps_with_other) if is_overlapping
end
end
Run Code Online (Sandbox Code Playgroud)