Class: ModelNotifier
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- ModelNotifier
- Defined in:
- lib/model_notifier.rb
Defined Under Namespace
Classes: Configuration
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.after_create(model) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/model_notifier.rb', line 10 def self.after_create(model) model_name = model.class.name.underscore.to_sym configuration = @configurations[model_name] ModelNotifier.deliver_notification_email configuration, model end |
.configure(&block) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/model_notifier.rb', line 3 def self.configure(&block) @configurations ||= {} configuration = configuration_from &block configure_model configuration.watched_model save_the configuration end |
Instance Method Details
#notification_email(configuration, model) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/model_notifier.rb', line 17 def notification_email(configuration, model) recipients configuration.deliver_to body :model => model subject configuration.subject_line mailer_name "#{self.class.name.underscore}/#{model.class.name.underscore}" end |