-
Notifications
You must be signed in to change notification settings - Fork 533
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 scaffold generator #1266
base: release-0-9
Are you sure you want to change the base?
Add scaffold generator #1266
Conversation
* scaffolds: models, resources, controllers, routes * change resource templates to .erb for better syntax highlighting support resolves: cerebris#1265
@@ -2,7 +2,7 @@ module Jsonapi | |||
class ControllerGenerator < Rails::Generators::NamedBase | |||
source_root File.expand_path('../templates', __FILE__) | |||
|
|||
def create_resource | |||
def create_controller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] Is the intention for these generators to refer to "resource" more generally, i.e. any kind of MVC element, or was it referring to a "resource" in the sense of the resource classes created and relied on by this library?
@@ -0,0 +1,120 @@ | |||
module Jsonapi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[note] In an effort to keep this simple, I've not broken the generators out in to sub-generators in called them from one meta-generator method. I'm not opposed to breaking them out if folks feel strongly about that.
if namespace_path.present? | ||
@application_record_class = application_record_class | ||
path = namespaced_file_path(models_path, 'application_record.rb') | ||
template 'application_record.erb', path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] I noticed in the generators that already exist here that file paths for templates are ran through File
, and I was wondering if that was a best practice that I was not aware of, or what the utility in doing so is? Would there not be an error with or without its use that points out that the file does not exist?
[question] I also noticed that the templates that already exist include a |
It would also be awesome if any field parameters for the model would be automatically added as |
Warning! - Work-in-progress
resolves: #1265
All Submissions:
New Feature Submissions:
Bug fixes and Changes to Core Features:
Test Plan:
TODO
Reviewer Checklist: