Skip to content

fix(generate): scaffold, api and auth output compile and pass on Amber V2 - #41

Draft
crimson-knight wants to merge 2 commits into
mainfrom
fix/generator-v2-apps
Draft

crimson-knight wants to merge 2 commits into
mainfrom
fix/generator-v2-apps

Conversation

@crimson-knight

Copy link
Copy Markdown
Member

Generated apps now compile and pass their own specs. Found by generating a fresh app against the new Grant (ActiveRecord parity wave 1).

  • Scaffold/API index use an explicit order(id: :desc) (Grant no longer adds an implicit ORDER BY id DESC).
  • .gitignore ignores *.db, *.db-wal, *.db-shm (SQLite runs in WAL mode).
  • field:reference emits belongs_to (which declares <field>_id); forms, controllers and specs use <field>_id.
  • generate api uses respond_with (Amber 2.0.0-beta.5 rejects render json:) and inserts the /api routes above the static wildcard.
  • generate auth [Name] defaults to User, stores a stdlib Crypto::Bcrypt::Password digest, adds authenticate, and renders compiling forms with csrf_tag. No new dependency.
  • Generated POST/PUT/DELETE specs run with a real CSRF token (spec/support/csrf_helpers.cr) instead of being commented out; CSRF stays on.
  • time fields render in the scaffold form.

Verified: a fresh app with scaffold Post, scaffold Comment post:reference, api Product and auth builds with no warnings; its generated specs pass 44/44 on the pinned Grant and 54/54 on the new Grant. amber_cli specs: 419 examples, 0 failures (with bin/amber-lsp built).

…n Amber V2 and Grant

- order index listings explicitly with order(id: :desc)
- reference fields emit belongs_to with a <name>_id foreign key, schema, form, and specs
- api controllers use respond_with { json ... } and routes are added under /api ahead of the static wildcard
- auth generates a bcrypt-backed model with authenticate, plain <form> views, routes, and specs; the name defaults to User
- write specs send a CSRF token through spec/support/csrf_helpers.cr instead of being commented out
- time fields render with to_rfc3339 in the form

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant