Class: SiteAssociationObserver

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/models/site_association_observer.rb

Instance Method Summary collapse

Instance Method Details

#before_validation(model) ⇒ Object



4
5
6
7
# File 'app/models/site_association_observer.rb', line 4

def before_validation(model)
  # Set the site_id automatically if it's not already set 
  model.site_id ||= model.class.current_site.id
end