What does the :: indicate in Rails 3?

I am implementing an API in Rails 3, and noticed an example controller defined like class Api::ToursController < ApplicationController. Does anyone know what the to colons indicate? Is it inheritance? Or is it indicating extending the ToursController? I have tried searching for an answer, but have not come up with anything.

Here is what I am referencing: https://github.com/nesquena/rabl/wiki/Set-up-rabl-for-Ruby-on-Rails


:: is the scope resolution operator (i.e. namespace operator) in many languages, including C++ and Ruby, so it's not specific to Rails.

In Ruby, modules define namespaces, so you can see code like this:

Net::HTTP.get 'stackoverflow.com'

Which calls the get class method on the HTTP class in the Net module.

In Rails, namespaces allow you to better organize your code (e.g. to separate your API controllers from the rest), and are implemented as modules.

Need Your Help

Sort array by one key then another key?

iphone cocoa sorting nsmutablearray

basically I have an array of dictionaries and each dictionary has a day, month and year field.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.