tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Returning to correct URL upon refresh #500

Closed sirvine closed 7 years ago

sirvine commented 7 years ago

Which operating system and version is the project developed on?

OSX 10.12.1.beta

Which version of ruby is the project developed on?

ruby 2.3.1p112

Which version of npm is the project developed on?

2.14.12

Which version of ember-cli is the project developed on?

2.9.1

What is the rails version?

4.2.6

What is the ember-cli-rails version (from Gemfile)?

0.8.1 631a161

What is the ember-cli-rails-addon version (from package.json)?

0.8.0

Is your application server multi-threaded (such as puma and unicorn) or is it multi-process (such as thin and webrick)?

thin

What are the contents of config/initializers/ember.rb?

EmberCli.configure do |c|
  c.app :portfolio, path: "portfolio"
end

What are the contents of the Rails' view that renders the Ember application?

= render_ember_app :portfolio do |head|
  - head.append do
    = csrf_meta_tags

How are the EmberCLI-related routes defined?

mount_ember_app :portfolio, to: "bastion", controller: "bastion", action: "index"

How is the application deployed?

Issue is in development.


When a user refreshes the browser from within my ember app, I'm unable to redirect the user to the same URL that they refreshed. Instead, the user is always returned to the root URL of the ember app.

I can see the relative path to the user's former location in params[:rest] on the controller action that is called by mount_ember_app after the refresh, but I don't know of any way to pass that information back to the ember app to guide the router to redirect to that path. I guess I could pass it via the DOM, but that feels really wrong.

Am I overlooking something obvious here?

sirvine commented 7 years ago

As it turns out, I was creating this issue. I had a this.transitionTo() in the Ember app's application route's model function that was intended to move users to root upon login, but was subsequently pushing everything back to root upon refresh.

I'll close this...