Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ember-cli/routes/routes_patch.rb

Instance Method Summary collapse

Instance Method Details

#ember_app(app, options) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ember-cli/routes/routes_patch.rb', line 2

def ember_app(app, options)
  scope = options.fetch(:scope, '')
  route = "#{scope}/#{app}"
  path = options.fetch(:path, route)
  dist_path = options.fetch(:dist_path, "#{path}/dist")

  Rails.application.routes.draw do
    match "/#{path}/assets/*filename",
      to: EmberCLI::Routes::EmberController.action(:handle_asset),
      as: "#{app}_asset_app",
      defaults: {
        path: path,
        dist_path: dist_path
      },
      via: :get
    match "/#{route}(/*path)",
      to: EmberCLI::Routes::EmberController.action(:handle),
      as: "#{app}_app",
      defaults: {
        path: path,
        dist_path: dist_path
      },
      via: :get
  end
end