Automatic Observer Registration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AppName | |
class Application < Rails::Application | |
config.encoding = "utf-8" | |
config.filter_parameters += [:password] | |
config.assets.enabled = true | |
config.assets.version = '1.0' | |
# registers any file in the app/observers directory as an observer | |
observers = [] # Register all observers in the observers folder. | |
pattern = File.join(Rails.application.config.root, 'app', 'observers', '**', '*.rb') | |
Dir.glob(pattern).each { |f| observers << File.basename(f, '.rb').to_sym } | |
config.active_record.observers = observers | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment