thoughtbot / ios-on-rails

A guide to building a Rails API and iOS app
Other
76 stars 6 forks source link

Show Command to Generate Controller in a Namespace #99

Closed davidbarsky closed 9 years ago

davidbarsky commented 9 years ago

I'm almost embarrassed to say this because it took me too much time to figure out, but:

I didn't know it was possible to generate code under a namespace (say, for new controllers) through the rails generate command.

I know that the philosophy of the book isn't a step-by-step tutorial, but a one-sentence blurb about namespacing and code generation in the first chapter would've proven very useful for me, and possibly a handful of readers.

EDIT: I know the Railscast mentioned namespacing, but it would've been useful to have a more explicit explanation.

jessieay commented 9 years ago

Hi @davidbarsky - thanks for opening this issue!

In my own Rails development, I only use Rails generators for creating migrations. Other than that, I manually create / write Rails files. This is why I didn't cover how to create a namespaced controller with rails generate. So, I am not inclined to include information about rails generators in the text of the book.

As a side note, it's generally a best practice to avoid generators. They insert a good amount of unnecessary code into a project that requires deleting. :rainbow:

Does that make sense? I am understanding your question correctly?

davidbarsky commented 9 years ago

@jessieay Yeah, that makes sense. Thanks for explaining!

jessieay commented 9 years ago

@davidbarsky cool! glad I could be helpful. Definitely open new issues or pull requests for anything else that you come upon - we have a professional editor going over the book now, but he is looking for writing-specific stuff. The code / explanations of code practices can always use improvement!