Sha256: 3b986a6bcf4e7fcf3673f9f8942841accc4dd4055ad057618b9b9b80d14a8ade

Contents?: true

Size: 525 Bytes

Versions: 3

Compression:

Stored size: 525 Bytes

Contents

PlanB::Engine.routes.draw do

  class FormatTest
    attr_accessor :mime_type

    def initialize(format)
      @mime_type = Mime::Type.lookup_by_extension(format)
    end

    def matches?(request)
      request.format == mime_type
    end
  end

  resources :hiking_profiles, constraints: FormatTest.new(:json)
  resources :itineraries,     constraints: FormatTest.new(:json)

  get '/*foo', to: 'angular#index', constraints: FormatTest.new(:html)
  root to: 'angular#index',         constraints: FormatTest.new(:html)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plan_b-0.0.2.pre1 config/routes.rb
plan_b-0.0.1.pre1 config/routes.rb
plan_b-0.0.1.pre config/routes.rb