Sha256: 272bd31a3004fd322bc89b971e077f57a0fd3b5e349b54cedeba418495a6678c

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

module CurationConcerns
  # Including WithoutNamespace on a controller allows us to prepend the default namespace to the params[:id]
  module WithoutNamespace
    extend ActiveSupport::Concern

    included do
      prepend_before_action :normalize_identifier, except: [:index, :create, :new]
    end

    protected

      def normalize_identifier
        params[:id] = CurationConcerns::Noid.namespaceize(params[:id])
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curation_concerns-0.3.0 app/controllers/concerns/curation_concerns/without_namespace.rb
curation_concerns-0.2.0 app/controllers/concerns/curation_concerns/without_namespace.rb