Sha256: 6b28fb92bdadc7b2cb6cad21d35e796262ebb5e133e64386cab86809e1e6af12

Contents?: true

Size: 754 Bytes

Versions: 10

Compression:

Stored size: 754 Bytes

Contents

require "ember_cli/ember_constraint"

module ActionDispatch
  module Routing
    class Mapper
      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

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ember-cli-rails-0.10.0 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.9.0 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.7 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.6 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.5 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.4 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.3 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.2 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.1 lib/ember_cli/route_helpers.rb
ember-cli-rails-0.8.0 lib/ember_cli/route_helpers.rb