Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用初始化脚本重载了模块的某些类。在模块中有一个类被调用Date,因此无法使用Date.today或其他日期方法。如何访问 Ruby/Rails 核心日期类?Rails::Date不起作用。
Date
Date.today
Rails::Date
您可以在 Date 类之前使用“::”。
Rails 只是扩展了 Ruby Core Date 类,所以你可以使用
::日期.今天