Module: SimpleAuthentication::ModelMethods::User
- Included in:
- User
- Defined in:
- lib/simple_authentication/model_methods.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.include(m) ⇒ Object
When another module is included in this one, include that module in all modules/classes that include this module This way if another module is included in this one after this module has been included elsewhere, those other classes will still have access to the methods in the included module.
-
.included(m) ⇒ Object
Keep a track of modules/classes that include this module.
- .model_classes ⇒ Object
Instance Method Summary collapse
Class Method Details
.include(m) ⇒ Object
When another module is included in this one, include that module in all modules/classes that include this module This way if another module is included in this one after this module has been included elsewhere, those other classes will still have access to the methods in the included module. Example:
User.include(SimpleAuthentication::ModelMethods::User) SimpleAuthentication::ModelMethods::User.include(OtherModule)
Normally, User wouldn’t have access to OtherModule’s methods, but we’re passing them on. This way, other plugins can add methods to User without having to load/touch it directly.
27 28 29 30 |
# File 'lib/simple_authentication/model_methods.rb', line 27 def self.include(m) self.model_classes.each{|c| c.send(:include, m) } super end |
.included(m) ⇒ Object
Keep a track of modules/classes that include this module
10 11 12 13 |
# File 'lib/simple_authentication/model_methods.rb', line 10 def self.included(m) model_classes << m m.extend ClassMethods end |
.model_classes ⇒ Object
5 6 7 |
# File 'lib/simple_authentication/model_methods.rb', line 5 def self.model_classes @model_classes ||= [] end |
Instance Method Details
#display_name ⇒ Object
32 33 34 |
# File 'lib/simple_authentication/model_methods.rb', line 32 def display_name name end |