All posts

Two colons before a class name in ruby

 ruby

When you see two colons before a constant reference in Ruby, like ::User that code is saying “look for this constant” defined without any namespace or nesting.

It will not look up Admin::User even if you make a reference to ::User from within the admin namespace.

Further reading:

Postscript:

I built two products to help fund continued efforts for this website, it would mean a lot if you would check them out:
1. 2500+ Words for the Undermotivated Software Engineer - A short essay I wrote on the titled topic ($3).
2. Build 3 Chrome Extensions in Under 2 Hours - A course I built to teach chrome extension development ($9-20).