Skip to content
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

Add missing api_controller that Rails 5 generator expects #2167

Open
wants to merge 2 commits into
base: 0-9-stable
Choose a base branch
from

Conversation

oyeanuj
Copy link

@oyeanuj oyeanuj commented Jul 27, 2017

Purpose

This allows AMS 0.9x to be used with Rails 5, without any errors.

Changes

Added an api_controller.rb template that the Rails 5 Generator expects.

Caveats

This fixes the main issue that I was facing in #1923 but as I experiment more, there might be more issues getting Rails 5, AMS 0.9x to play well.

Related GitHub issues

#1923

Additional helpful information

Thanks @bf4 @remear for your help debugging this issue.

@bf4
Copy link
Member

bf4 commented Aug 13, 2017

@oyeanuj Sorry for the delay in responding to this: what's the error? I'm not sure why AMS should be adding a controller generator template

@oyeanuj
Copy link
Author

oyeanuj commented Aug 20, 2017

@bf4 So, it seems that Rails 5 in API mode expects there to be these controller generators which were missing and causing errors mentioned in #1923.

Also, to point out that 0.9x already had controller template but it was named controller.rb. In API mode, it seems to expect the controller generator to be named as api_controller.rb.

@bf4
Copy link
Member

bf4 commented Nov 2, 2017

@oyeanuj would you be up to rebase and force push this?

@bf4
Copy link
Member

bf4 commented Nov 19, 2017

I think it might make more sense to avoid the api controller template. There's nothing different in it from the Rails default, right?

module Rails
  module Generators
    class ScaffoldControllerGenerator
-      if Rails::VERSION::MAJOR >= 4
+      if Rails::VERSION::MAJOR >= 4 && ApplicationController < ActionController::Base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants