0
我定義以下型號方法:Rails3中不能從NilClass反覆模型法
def live
deb = start_date||= 100.years.ago # if the start date is nil, it's live
fin = end_date||=100.years.from_now # if the end date is nil, it's live
Date.today.between?(deb, fin)
end
如果開始日期和結束日期都充滿,該方法返回正確的價值,如果他們(true或false) '無,它引發錯誤「不能從NilClass迭代」