Sha256: f4305e01a53d4356dab1b0ef8c6a19ffd28c4a3d5f111fbc0a79f182adb655e4

Contents?: true

Size: 495 Bytes

Versions: 22

Compression:

Stored size: 495 Bytes

Contents

module Guts
  # Handled adding a default scope to Active Record calls for multisites
  module MultisiteScopeConcern
    extend ActiveSupport::Concern
    
    included do
      # http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Default/ClassMethods.html
      default_scope do
        # Scope queries to the current site
        # See: Guts::ApplicationController#current_site for where current_id is set to model
        where(site_id: Guts::Site.current_id)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
guts-3.1.2 app/concerns/guts/multisite_scope_concern.rb
guts-3.1.1 app/concerns/guts/multisite_scope_concern.rb
guts-3.1.0 app/concerns/guts/multisite_scope_concern.rb
guts-3.0.1 app/concerns/guts/multisite_scope_concern.rb
guts-3.0.0 app/concerns/guts/multisite_scope_concern.rb
guts-2.1.0 app/concerns/guts/multisite_scope_concern.rb
guts-2.0.2 app/concerns/guts/multisite_scope_concern.rb
guts-2.0.1 app/concerns/guts/multisite_scope_concern.rb
guts-2.0.0 app/concerns/guts/multisite_scope_concern.rb
guts-1.4.0 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.6 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.5 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.4 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.3 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.2 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.1 app/concerns/guts/multisite_scope_concern.rb
guts-1.3.0 app/concerns/guts/multisite_scope_concern.rb
guts-1.2.2 app/concerns/guts/multisite_scope_concern.rb
guts-1.2.1 app/concerns/guts/multisite_scope_concern.rb
guts-1.2.0 app/concerns/guts/multisite_scope_concern.rb