lib/generators/documentation/scaffold/templates/resource.md.tt in documentation-zero-0.0.2 vs lib/generators/documentation/scaffold/templates/resource.md.tt in documentation-zero-0.0.3

- old
+ new

@@ -8,11 +8,11 @@ - [Update <%= human_name.downcase %>](#update-<%= singular_name.dasherize %>) - [Delete <%= human_name.downcase %>](#delete-<%= singular_name.dasherize %>) ## Get <%= human_name.pluralize.downcase %> -- `GET /<%= plural_name %>.json` will return a [paginated list](../readme.md#pagination) of <%= human_name.pluralize.downcase %>. +- `GET /<%= plural_name %>.json` will return a [paginated list](../README.md#pagination) of <%= human_name.pluralize.downcase %>. <!-- _Optional query parameters_: * `attribute1` - when set to true, will only return resources that are completed. @@ -39,26 +39,26 @@ <% attributes.each do |attribute| -%> * `<%= attribute.column_name %>` - attribute from <%= human_name.downcase %>. <% end -%> -This endpoint will return `201 Created` with the current JSON representation of the <%= human_name.downcase %> if the creation was a success. See the [<%= human_name.downcase %>](#model) model for more info on the payload. +This endpoint will return `201 Created` with the current JSON representation of the [<%= human_name.downcase %>](#model) if the creation was a success. ## Update <%= human_name.downcase %> - `PUT /<%= plural_name %>/1.json` allows changing the <%= human_name.downcase %> with an ID of `1`. -This endpoint will return `200 OK` with the current JSON representation of the <%= human_name.downcase %> if the update was a success. See the [<%= human_name.downcase %>](#model) model for more info on the payload. +This endpoint will return `200 OK` with the current JSON representation of the [<%= human_name.downcase %>](#model) if the update was a success. <!-- **Required parameters**: `attribute1` and `attribute2`. --> _Optional parameters_: -<% attributes.each do |attribute| -%> -* `<%= attribute.column_name %>` - attribute from <%= human_name.downcase %>. +<% attributes_names.each do |attribute| -%> +* `<%= attribute %>` - attribute from <%= human_name.downcase %>. <% end -%> ## Delete <%= human_name.downcase %> - `DELETE /<%= plural_name %>/1.json` will delete the <%= human_name.downcase %> with an ID of `1`. @@ -69,9 +69,17 @@ ## Model ```json { <% attributes.each do |attribute| -%> +<% if attribute.password_digest? -%> + "password_digest": "string", +<% elsif attribute.token? -%> + "<%= attribute.column_name %>": "string", +<% elsif attribute.reference? -%> + "<%= attribute.column_name %>": "integer", +<% elsif !attribute.virtual? -%> "<%= attribute.column_name %>": "<%= attribute.type %>", +<% end -%> <% end -%> } ```