Sha256: 8b028a62debc31cfc2e6fa849c89ec0e3f7b50f5eff296d61aac02eca29295cd

Contents?: true

Size: 934 Bytes

Versions: 31

Compression:

Stored size: 934 Bytes

Contents

module ActionDispatch::Routing
  class Mapper
    # example
    #   blacklight_for :catalog
    #   blacklight_for :catalog, :dashboard
    #   blacklight_for :catalog, except: [ :saved_searches ]
    #   blacklight_for :catalog, only: [ :saved_searches, :solr_document ]
    #   blacklight_for :catalog, constraints: {id: /[0-9]+/ }
    def blacklight_for(*resources)
      raise_no_blacklight_secret_key unless Blacklight.secret_key
      options = resources.extract_options!
      resources.map!(&:to_sym)

      Blacklight::Routes.new(self, options.merge(resources: resources)).draw
    
    end
    
    private
    def raise_no_blacklight_secret_key #:nodoc:
      raise <<-ERROR
Blacklight.secret_key was not set. Please add the following to an initializer:

Blacklight.secret_key = '#{SecureRandom.hex(64)}'

Please ensure you restarted your application after installing Blacklight or setting the key.
ERROR
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
blacklight-5.13.1 lib/blacklight/rails/routes.rb
blacklight-5.13.0 lib/blacklight/rails/routes.rb
blacklight-5.11.3 lib/blacklight/rails/routes.rb
blacklight-5.12.1 lib/blacklight/rails/routes.rb
blacklight-5.12.0 lib/blacklight/rails/routes.rb
blacklight-5.10.3 lib/blacklight/rails/routes.rb
blacklight-5.9.4 lib/blacklight/rails/routes.rb
blacklight-5.11.2 lib/blacklight/rails/routes.rb
blacklight-5.11.1 lib/blacklight/rails/routes.rb
blacklight-5.11.0 lib/blacklight/rails/routes.rb
blacklight-5.10.2 lib/blacklight/rails/routes.rb
blacklight-5.10.1 lib/blacklight/rails/routes.rb
blacklight-5.10.0 lib/blacklight/rails/routes.rb
blacklight-5.9.3 lib/blacklight/rails/routes.rb
blacklight-5.9.2 lib/blacklight/rails/routes.rb
blacklight-5.9.1 lib/blacklight/rails/routes.rb
blacklight-5.9.0 lib/blacklight/rails/routes.rb
blacklight-5.8.2 lib/blacklight/rails/routes.rb
blacklight-5.8.1 lib/blacklight/rails/routes.rb
blacklight-5.8.0 lib/blacklight/rails/routes.rb