Reputation: 1319
So far when learning Ruby and Ruby on Rails I keep encountering the syntax
ActionController::Base
And have never clarified exactly what it means. Why the :: instead of say, a slash? Wouldn't ActionController/Base be more specific?
For example, while using the Globalize3 gem I added to my model the line
class About < ActiveRecord::Base
translates :message
end
I get the generated model named MonthlyPost::Translation, but that doesn't explain much. Where exactly are these stored, and what does the :: mean? Any thoughts would be wonderful. Thanks.
Upvotes: 0
Views: 403
Reputation: 13877
Rails is ruby. Learn ruby and your questions will be answered.
Upvotes: 0
Reputation: 44073
ActionController::Base means find the class Base in the module ActionController.
It's a way of organising your classes, and also to avoid conflicts with classes made by others.
Here is a good article explaining how to use Modules for namespaces.
Upvotes: 5