Sha256: 8f342fd162b72e07f0a6edd1ef7a2d2040d5ced6b3a480c90d82d15576c58a04
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require "ember_cli/ember_constraint" require "ember_cli/trailing_slash_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 redirect_if_missing_trailing_slash = { constraints: EmberCli::TrailingSlashConstraint.new, to: redirect(-> (_, request) { File.join(request.path, "/?#{request.query_parameters.to_query}") }), } get(to, redirect_if_missing_trailing_slash) get(File.join(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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ember-cli-rails-0.12.2 | lib/ember_cli/route_helpers.rb |
ember-cli-rails-0.12.1 | lib/ember_cli/route_helpers.rb |
ember-cli-rails-0.12.0 | lib/ember_cli/route_helpers.rb |