Sha256: b944e4ac1213f42974846b42ae781b6077df8237df1e692f51ada42326d1b04f

Contents?: true

Size: 280 Bytes

Versions: 4

Compression:

Stored size: 280 Bytes

Contents

class SiteAssociationObserver < ActiveRecord::Observer
  observe *VhostExtension::SITE_SPECIFIC_MODELS.collect(&:constantize)
  
  def before_validation(model)
    # Set the site_id automatically if it's not already set 
    model.site_id ||= model.class.current_site.id
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-vhost-extension-2.3.1 app/models/site_association_observer.rb
radiant-vhost-extension-2.3.0 app/models/site_association_observer.rb
radiant-vhost-extension-2.2.0 app/models/site_association_observer.rb
radiant-vhost-extension-2.1.0 app/models/site_association_observer.rb