otwarchive-symphonyarchive/lib/ EXAMPLE_MODULE.rb.example

23 lines
680 B
Text
Raw Permalink Normal View History

2026-03-11 22:22:11 +00:00
# Describe what the module does up here
# This then gets included in whatever class you're working on:
# "include [module name]"
module Example
# Class methods are ones that you run with "ClassName.whatever" -- you would define them
# in the class as "def self.whatever"
# Here you need to define them WITHOUT the "self." part :)
module ClassMethods
end # CLASS METHODS
# This last housekeeping method will load up the class methods and
# any associations or validations into your class
def self.included(base)
base.class_eval do
# put any association or validations here, eg has_many, etc
end
base.extend(ClassMethods)
end
end