Repository navigation
fix(generate): scaffold, api and auth output compile and pass on Amber V2 - #41
Merged
Merged
Conversation
…t above the static wildcard
…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
The generated spec_helper loaded config/ without setting AMBER_ENV, so crystal spec wrote to the development database. The new scaffold specs create records, which left the smoke test's first POST at /pets/8 instead of /pets/1. Default AMBER_ENV to test before config loads.
install-crystal runs apt-get install without apt-get update; the runner image's stale index now 404s on superseded libevent packages.
crimson-knight
marked this pull request as ready for review
October 2, 2026 23:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated apps now compile and pass their own specs. Found by generating a fresh app against the new Grant (ActiveRecord parity wave 1).
order(id: :desc)(Grant no longer adds an implicit ORDER BY id DESC).*.db,*.db-wal,*.db-shm(SQLite runs in WAL mode).field:referenceemitsbelongs_to(which declares<field>_id); forms, controllers and specs use<field>_id.generate apiusesrespond_with(Amber 2.0.0-beta.5 rejectsrender json:) and inserts the/apiroutes above the static wildcard.generate auth [Name]defaults to User, stores a stdlibCrypto::Bcrypt::Passworddigest, addsauthenticate, and renders compiling forms withcsrf_tag. No new dependency.spec/support/csrf_helpers.cr) instead of being commented out; CSRF stays on.timefields render in the scaffold form.Verified: a fresh app with
scaffold Post,scaffold Comment post:reference,api Productandauthbuilds 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 (withbin/amber-lspbuilt).