Moving notifications to models
This commit is contained in:
parent
a39f4cf0dd
commit
ebdf0df410
6 changed files with 86 additions and 18 deletions
|
|
@ -12,6 +12,14 @@ class Venue < ActiveRecord::Base
|
|||
size: { in: 0..500.kilobytes }
|
||||
accepts_nested_attributes_for :lodgings, allow_destroy: true
|
||||
|
||||
def venue_notify?(conference)
|
||||
(self.name_changed? || self.address_changed?) &&
|
||||
(!self.name.blank? && !self.address.blank?) &&
|
||||
(conference.email_settings.send_on_venue_update &&
|
||||
!conference.email_settings.venue_update_subject.blank? &&
|
||||
conference.email_settings.venue_update_template)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# TODO: create a module to be mixed into model to perform same operation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue