Sha256: b0db1881b8c3cf0cefc1aca8510116e890ceb80e27ab1a5050e8a893234ce75b

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

require "ember_cli/html_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,
        )

        dist_directory = EmberCli[app_name].paths.dist

        Rails.application.routes.draw do
          scope constraints: EmberCli::HtmlConstraint.new do
            get("#{to}(*rest)", routing_options)
          end

          mount Rack::File.new(dist_directory.to_s) => to
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ember-cli-rails-0.6.0 lib/ember_cli/route_helpers.rb