Closed rmcsharry closed 8 years ago
@rmcsharry thanks for opening this issue.
Have you compared your approach to the one illustrated in the example repository?
Additionally, this gem is tested against a dummy Rails 5 application.
Could you compare your configuration against those working examples? If you find anything that you're doing differently that might help us understand the root of your issue.
@seanpdoyle Thanks for the fast response. Yes I've compared it, the only difference I see now is the '2nd app' in the example has an AdminController (ie named after the app). So I will try adding that and let you know.
However, I also reset the code and tried again with a brand new ember app (ember new frontend) inside folder 'frontend' as per the example. Rails did not build this either.
Could it be something to do with using Rails new --api flag when I first setup up Rails? Is the dummy app a Rails 5 api app or a full Rails app?
@seanpdoyle This vanilla repro reproduces the problem.
1 rails new ertest --api 2 add ember-cli-rails to gemfile 3 bundle install (installs 0.8.0) 4 rails g ember:init 5 config/routes.rb -> add mount_ember_app :frontend, to: "/" 6 ember new frontend --git-skip 7 cd frontend 8 ember install ember-cli-rails-addon (installs 0.8.0) 9 added 'test' to frontend/app/index.html 10 rails server
Same problem - 'test' (from step 9) is not rendered as it seems rails does not mount the frontend app.
@rmcsharry thanks a lot for those details, and especially a public repository that reproduces your issue!
@rmcsharry I've created https://github.com/thoughtbot/ember-cli-rails/pull/481 and tested it against your sample application.
It doesn't yet resolve your issue, but it's a good start.
The next step is to add feature-level test coverage of ember-cli-rails
running against a rails new --api
application.
@seanpdoyle A great start, and so fast too!
It's nice to know my hunch was right about using rails new --api
👍
I wish I had the expertise (and time) to assist you but I'm afraid I have neither. :(
The main reason I chose this gem was to make life easier (eg. fast deploys to Heroku), rather than having to mess with deploying two separate apps. I'd rather use the gem if I can, so just wondering if you have a rough estimate on how long you think it might take to fix?
In the mean time, could you try out PR#481, and let us know if that resolves your issue:
# Gemfile
gem "ember-cli-rails", github: "thoughtbot/ember-cli-rails", branch: "support-api-controller"
@seanpdoyle Yes I'll do that tonight and let you know.
@seanpdoyle Awesome! The ertest app works with that branch 👍
I will try it on my actual app now and report back.
It works. :) You are my new hero @seanpdoyle !
Published in 0.8.0
Which operating system and version is the project developed on? OSX El Capitan
Which version of
ruby
is the project developed on? 2.3.1Which version of
npm
is the project developed on? 3.10.6Which version of
ember-cli
is the project developed on? 2.7What is the
rails
version? 5.0.0.1What is the
ember-cli-rails
version (fromGemfile
)? 0.8.0What is the
ember-cli-rails-addon
version (frompackage.json
)? 0.8.0Is your application server multi-threaded (such as
puma
andunicorn
) or is it multi-process (such as thin and webrick)? pumaWhat are the contents of
config/initializers/ember.rb
? EmberCli.configure do |c| c.app :gearclient, path: "frontend" endWhat are the contents of the Rails' view that renders the Ember application? It's empty - the guide says nothing about it (unless you want to override it). By default the EmbercliController should render the ember app's index.html, but it doesn't. Seems it cannot find or mount the ember app.
I tried putting an empty view here: app/views/ember_cli/index.html.erb
Also tried filling it with: <%= render_ember_app ember_app do |head| %> <% head.append do %> <%= csrf_meta_tags %> <% end %> <% end %>
But neither options worked.
How are the EmberCLI-related routes defined? mount_ember_app :gearclient, to: "/"
How is the application deployed? It's not, this is locally in development
In Rails root is a folder called frontend. Inside that is the full ember app called 'gearclient' (ie. it is not in a subfolder of frontend, but the ember app in package.json is called 'gearclient')
The output from Rails log is this, clearly shows that the Ember App is not bootstrapped/mounted.
=> Booting Puma => Rails 5.0.0.1 application starting in development on http://localhost:3000 => Run
rails server -h
for more startup options Puma starting in single mode...I have also tried changing the initializer and the route to use :frontend instead of :gearclient, but also did not work.