Sha256: 8a70d1bfa10d87679acf31a8564772327fac6d8f8b9baf480a7f8e77048bbe81

Contents?: true

Size: 426 Bytes

Versions: 5

Compression:

Stored size: 426 Bytes

Contents

module Api
  module TaxonomyScope
    extend ActiveSupport::Concern

    included do
      before_filter :set_taxonomy_scope
    end

    def set_taxonomy_scope
      Location.current ||= @location = Location.find_by_id(params[:location_id]) if SETTINGS[:locations_enabled]
      Organization.current ||= @organization = Organization.find_by_id(params[:organization_id]) if SETTINGS[:organizations_enabled]
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/controllers/concerns/api/taxonomy_scope.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/controllers/concerns/api/taxonomy_scope.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/controllers/concerns/api/taxonomy_scope.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/controllers/concerns/api/taxonomy_scope.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/controllers/concerns/api/taxonomy_scope.rb