Sha256: e01f9ff6d2bc3abb98ebf4f325646f9325c357b48129d6e084af7e78aa5813ae

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 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,
        )

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

          dist_directory = EmberCli[app_name].paths.dist

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

Version data entries

2 entries across 2 versions & 1 rubygems

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