-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 5 API support #376
Comments
The other solution would be to add a note in readme to make ApplicationController inherit ActionController::Base when using Rails 5 API. |
@ivanjolic95 thanks for opening this issue. I'm unfamiliar with most of the changes coming in Rails 5, so I'm having trouble following your suggestions. Are you saying that when you |
Yeah, that's right. |
And if you try to use this gem with it, there's an error because helper_method is not defined for the ActionController::API |
@ivanjolic95 @seanpdoyle I updated my project with rails 5 beta 1. I am using full rails(not only API) and I get 500 standard error instead of ember application and nothing in server logs. |
@KirillSuhodolov it's working for me when I use ActionController::Base. Which version of ember are you using? |
If anyone is following this issue and needs ember-cli-rails support with a Rails 5 build, feel free to use my fork of this repository (updated for use with Rails 5) until this gets straightened out. I'll keep it as current as possible. Thoughts on this going forward, @seanpdoyle? Would love to send a patch through to you. |
Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Closes [#376]. [#376]: #376 [rails]: https://github.com/rails/rails
#400 attempts to fix this issue. |
Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Closes [#376]. [#376]: #376 [rails]: https://github.com/rails/rails
Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Closes [#376]. [#376]: #376 [rails]: https://github.com/rails/rails
Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. Closes [#376]. [#376]: #376 [rails]: https://github.com/rails/rails
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
@CollinGraves @ivanjolic95 @KirillSuhodolov #400 supports Rails Would you mind seeing if it resolves your issues?: # Gemfile
gem "ember-cli-rails", github: "thoughtbot/ember-cli-rails", branch: "sd-rails-5" Unfortunately, Rails 5 depends on Dropping support for older Rubies constitutes a breaking change, and according to semantic versioning will require a major bump (in our case, a minor bump since the project is pre This will delay the release of Rails 5 support. Before we introduce a breaking change, I'd like to wait until the stable release of Rails 5 (i.e. no Does that sound reasonable? |
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
@seanpdoyle I have tried your above solution, using the
I have followed the setup instructions and did not customize any view since the base Rails app is an API only configured Rails app. |
@makabde thanks for the additional information. Just to clarify, in your application,
Could you share the HTML that is returned? Are there any |
@seanpdoyle yes, that right. |
@makabde thanks!
Could you share the HTML that is returned? Are there any |
@seanpdoyle I created a repo so that you can maybe clone it and try yourself. So far both, the Rails and the Ember app are new but I would still expect to see the "Welcome to Ember", if everything was working as expected. https://github.com/makabde/tapp Also some screenshots of the returned HTML and of the browsers network tab. |
The @makabde Please see this new commit. |
@seanpdoyle The application now runs as expected, with this new commit. Do you think you will be able to come up with a solution that you will somehow prevent those side-effect you were referencing in the commit. On the other hand would you recommend sticking to a "regular" Rails app with a dedicated controller for the API that will inherit from |
@makabde this commit attempts to avoid
This feels like an awful idea, but is effective in leveraging application-wide controller logic shared in |
👍 |
I get the following error:
even when using |
Closes [tricknotes#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [tricknotes#376]: tricknotes#376 [rails]: https://github.com/rails/rails
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
Any updates? |
FYI, to those interested, I've just submitted #466 which fixes the "undefined method 'render_ember_app'" error and gets the branch |
Rails 5 launched and ember-cli-rails does not support it... :( ember-cli-rails was resolved to 0.7.4, which depends on |
@williamweckl My fork https://github.com/undergroundwebdevelopment/ember-cli-rails/tree/sd-rails-5 is working for me, and includes the railties dependency bump. |
@undergroundwebdesigns ty :) |
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
What is status of this? Rails 5 is now stable. |
@seanpdoyle seems like this is related to RVM and JRuby in general, not to this gem jruby/jruby#2496. |
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. **Improve `setup_ember` script** * Don't overwrite `gemfiles/` changes with `appraisal install` * Localize Ember setup to `bin/setup_ember` * Always invoke, let `bin/setup_ember` decide whether or not to no-op **Fix `EmberCli::EmberController` inheritance** The `EmberCli::EmberController` used to inherit from `ApplicationController` in order to reap the benefits of application-wide configurations and behavior (such as authentication-based `before_action` calls and other macros). Unfortunately, with the introduction of Rails 5's `rails new --api`, applications' `ApplicationController` can now inherit from [`ActionController::API`][api], which doesn't serve HTML by default. To support Rails 5's default `--api` behavior, `EmberCli::EmberController` must inherit from `ActionController::Base`, forcing the controller to forfeit all the benefits of sharing behavior with `ApplicationController`. [api]: http://edgeapi.rubyonrails.org/classes/ActionController/API.html **Depend on `test-unit`** ``` Ruby 2.2+ has removed test/unit from the core library. Rails requires this as a dependency. Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (cannot load such file -- test/unit)" ``` Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. **Allow JRuby failures in CI** **Improve `setup_ember` script** * Don't overwrite `gemfiles/` changes with `appraisal install` * Localize Ember setup to `bin/setup_ember` * Always invoke, let `bin/setup_ember` decide whether or not to no-op **Fix `EmberCli::EmberController` inheritance** The `EmberCli::EmberController` used to inherit from `ApplicationController` in order to reap the benefits of application-wide configurations and behavior (such as authentication-based `before_action` calls and other macros). Unfortunately, with the introduction of Rails 5's `rails new --api`, applications' `ApplicationController` can now inherit from [`ActionController::API`][api], which doesn't serve HTML by default. To support Rails 5's default `--api` behavior, `EmberCli::EmberController` must inherit from `ActionController::Base`, forcing the controller to forfeit all the benefits of sharing behavior with `ApplicationController`. [api]: http://edgeapi.rubyonrails.org/classes/ActionController/API.html **Depend on `test-unit`** ``` Ruby 2.2+ has removed test/unit from the core library. Rails requires this as a dependency. Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (cannot load such file -- test/unit)" ``` Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
closed by #400 |
Closes [tricknotes#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. **Allow JRuby failures in CI** **Improve `setup_ember` script** * Don't overwrite `gemfiles/` changes with `appraisal install` * Localize Ember setup to `bin/setup_ember` * Always invoke, let `bin/setup_ember` decide whether or not to no-op **Fix `EmberCli::EmberController` inheritance** The `EmberCli::EmberController` used to inherit from `ApplicationController` in order to reap the benefits of application-wide configurations and behavior (such as authentication-based `before_action` calls and other macros). Unfortunately, with the introduction of Rails 5's `rails new --api`, applications' `ApplicationController` can now inherit from [`ActionController::API`][api], which doesn't serve HTML by default. To support Rails 5's default `--api` behavior, `EmberCli::EmberController` must inherit from `ActionController::Base`, forcing the controller to forfeit all the benefits of sharing behavior with `ApplicationController`. [api]: http://edgeapi.rubyonrails.org/classes/ActionController/API.html **Depend on `test-unit`** ``` Ruby 2.2+ has removed test/unit from the core library. Rails requires this as a dependency. Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (cannot load such file -- test/unit)" ``` Support changes --------------- Rails 5 depends on `rack@2.0.x`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [tricknotes#376]: tricknotes#376 [rails]: https://github.com/rails/rails
Are there any plans to support Rails 5 API? The problem with it is that API controllers don't have helper_method. One solution would be to inherit gem's EmberController from a special EmberController (or whatever the name is) in app that inherits ActionController::Base instead of ActionController::API. Right now it inherits ApplicationController which is an API controller in Rails 5 API. I've configured ember-cli-rails to support testing the gem on Rails 5.0.0.beta1 locally so I can make it work that way.
The text was updated successfully, but these errors were encountered: