且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ruby on Rails 中模型的完全限定名称是什么?

更新时间:2023-02-08 19:40:57

使用他们的全名,FooModule::User 和 ::User

Refer to them using their full names, FooModule::User and ::User

一般来说,如果你只使用 User,它应该假设你的意思是 ::User,除非你在 FooModule 中.无论哪种方式,请使用 FooModule::User 或 ::User 来确保.

Generally if you just use User, it should assume you mean ::User, unless you are within FooModule. Either way, use FooModule::User or ::User to be sure.