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

Generator doesn't properly handle "api/posts' #1987

Closed
halfdan opened this Issue Oct 31, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@halfdan

halfdan commented Oct 31, 2015

When running the controller generator: padrino g controller api/posts it properly creates files in app/controllers/api/ and app/helpers/api/ but the code is invalid.

MyApp::App.controllers :api/exercises do

end

I'm essentially trying to create a sub-namespace and I'm sure there's another way to do this, but the generator shouldn't really create invalid code.

@ujifgc ujifgc added the bug label Oct 31, 2015

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Dec 12, 2015

Member

Would you like to provide a minimal working human-generated project for us to refer? I'm not sure what are you trying to achieve by namespacing the controller. As I understand Padrino, Api should be an app inside your project.

Member

ujifgc commented Dec 12, 2015

Would you like to provide a minimal working human-generated project for us to refer? I'm not sure what are you trying to achieve by namespacing the controller. As I understand Padrino, Api should be an app inside your project.

@halfdan

This comment has been minimized.

Show comment
Hide comment
@halfdan

halfdan Feb 1, 2016

Hi @ujifgc,
I think I went about this the wrong way. There are two solutions to my problem:

  • Have the API in an app mounted as /api and then simply add the controllers there
  • Have an ApiExercisesController that has a simple map: '/api/exercises

I'm not sure what the generator should do here as the intention isn't clear - I suppose it could straight out reject to generate anything with a / in it.

halfdan commented Feb 1, 2016

Hi @ujifgc,
I think I went about this the wrong way. There are two solutions to my problem:

  • Have the API in an app mounted as /api and then simply add the controllers there
  • Have an ApiExercisesController that has a simple map: '/api/exercises

I'm not sure what the generator should do here as the intention isn't clear - I suppose it could straight out reject to generate anything with a / in it.

@ujifgc ujifgc closed this in 6e1c7cc Feb 1, 2016

@halfdan

This comment has been minimized.

Show comment
Hide comment
@halfdan

halfdan Feb 1, 2016

@ujifgc Nice! Thanks

halfdan commented Feb 1, 2016

@ujifgc Nice! Thanks

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc Feb 1, 2016

Member

You are welcome, thank you for your report.

Member

ujifgc commented Feb 1, 2016

You are welcome, thank you for your report.

ujifgc added a commit that referenced this issue Sep 8, 2016

properly refuse to generate erroneous code, fixes #1987
Padrino-gen now properly fails with NameError when provided
with erroneous controller, helper, mailer, migration, task name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment