Sha256: 4ec77c72696d2299a1a6eb5a050b0291747a425f024ca30e4369a0951c452917

Contents?: true

Size: 421 Bytes

Versions: 6

Compression:

Stored size: 421 Bytes

Contents

module Worthwhile
  # 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_filter :normalize_identifier, except: [:index, :create, :new]
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
worthwhile-0.1.2 app/controllers/concerns/worthwhile/without_namespace.rb
worthwhile-0.1.1 app/controllers/concerns/worthwhile/without_namespace.rb
worthwhile-0.1.0 app/controllers/concerns/worthwhile/without_namespace.rb
worthwhile-0.0.3 app/controllers/concerns/worthwhile/without_namespace.rb
worthwhile-0.0.2 app/controllers/concerns/worthwhile/without_namespace.rb
worthwhile-0.0.1 app/controllers/concerns/worthwhile/without_namespace.rb