Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ember_cli/route_helpers.rb

Instance Method Summary collapse

Instance Method Details

#mount_ember_app(app_name, to:, **options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ember_cli/route_helpers.rb', line 6

def mount_ember_app(app_name, to:, **options)
  routing_options = options.deep_merge(
    defaults: { ember_app: app_name },
  )

  routing_options.reverse_merge!(
    controller: "ember_cli/ember",
    action: "index",
    format: :html,
  )

  scope constraints: ::EmberCli::EmberConstraint.new do
    get("#{to}(*rest)", routing_options)
  end

  mount_ember_assets(app_name, to: to)
end

#mount_ember_assets(app_name, to: "/") ⇒ Object



24
25
26
27
28
29
30
# File 'lib/ember_cli/route_helpers.rb', line 24

def mount_ember_assets(app_name, to: "/")
  app = ::EmberCli[app_name]

  if app.mountable?
    mount app.to_rack => to
  end
end