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

Allow generating plugins for API applications #21003

Merged
merged 5 commits into from
Jul 27, 2015
Merged

Allow generating plugins for API applications #21003

merged 5 commits into from
Jul 27, 2015

Conversation

robin850
Copy link
Member

Hello,

This pull requests adds a --api option in order to generate plugins that can be added inside API applications. It is split into several commits to ease the review process but once everything is fine, I can squash them.

Cross-refs #19832 and the todo on Basecamp.

Have a nice day.

@robin850 robin850 added this to the 5.0.0 milestone Jul 23, 2015
This way, running a generator inside the plugin's directory, files that
are not relevant won't be generated (e.g. views or assets).

This won't interfere with the application's generators configuration.
rafaelfranca added a commit that referenced this pull request Jul 27, 2015
Allow generating plugins for API applications
@rafaelfranca rafaelfranca merged commit 695937c into rails:master Jul 27, 2015
@rafaelfranca
Copy link
Member

Is the dummy app API only already?

@robin850
Copy link
Member Author

@rafaelfranca : Thanks for merging! I'm not sure to understand your question though ; the dummy app has been made API-only in robin850@ce32c9d.

@spastorino
Copy link
Contributor

@robin850 👍, looks good from what I see. Will review properly next week.

@rafaelfranca
Copy link
Member

@spastorino it is already merged 😄

@robin850 I see, thank you for pointing.

@spastorino
Copy link
Contributor

@rafaelfranca I know but a couple of more eyes taking a look at it wouldn't hurt :)

@jmbejar
Copy link
Contributor

jmbejar commented Aug 3, 2015

@robin850 @rafaelfranca @spastorino I found a little issue related with this PR.

Let's say you have a fresh only api application (created with rails new --api) that is the host application. Then you create an engine with --api option and some stuff using the scaffold generator.

Once you mount the engine and try the new routes in the host application, you get an undefined methodnew' for nil:NilClass` error in this line into AMS.

The problem happens because AMS is not present when the resources are created in the engine, so serializers classes are not created (in fact, AMS does not seem to work in the context of an engine, adding this gem to the engine project is not enough). However, since AMS is added by default to a new rails api-only app, the exception will happen.

Removing AMS from the host application solves the problem, but I'm concerned because this is not the default setup.

This is probably material for a separate issue ticket, since I don't have a clear solution yet.

@rafaelfranca
Copy link
Member

Yeah, a separate issue would be better.

@rafaelfranca rafaelfranca modified the milestones: 5.0.0 [temp], 5.0.0 Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants