Bind ActiveRecord::Schema.define + class < ActiveRecord::Base (stage-4b hard PASS)#105
Merged
Conversation
Extend the go-ruby-activerecord binding so the idiomatic Rails-style ORM
route runs end to end (conformance stage 4b flips SKIP -> hard PASS):
- ActiveRecord::Schema.define { create_table … } runs a DDL block whose
create_table renders CREATE TABLE (+ CREATE INDEX) through the connected
sqlite3 adapter — the same adapter Model.create/where already use. The
create_table column DSL covers string/integer/float/boolean/text/
datetime/timestamp/date/time/binary/decimal/bigint, timestamps,
references/belongs_to, the generic column, t.index, primary_key, and the
id:/primary_key: options; add_index/add_column/execute round it out.
- A `class User < ActiveRecord::Base` subclass becomes a working model:
its table name is inferred via activerecord.Tableize (or set with
self.table_name =) and it answers all/where/order/count/first/find/
create/create! by lazily resolving a cached model and reusing the same
chainable Relation surface. Records answer their columns as dynamic
reader/writer accessors (method_missing/respond_to_missing?), so an
AR-loaded row renders through the u.name calls a Rails view uses.
Uses go-ruby-activerecord's Tableize/Pluralize + TableDef.PrimaryKey
(added there, re-pinned). 100% coverage on the new binding; full vm suite
green under TZ=UTC; schema Ruby source is Windows-safe (no host paths).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes the last web-app run-conformance gap: the idiomatic ActiveRecord ORM route now runs end to end, so
TestStage4bActiveRecordflips from SKIP to a hard PASS.What ran before / runs now
The AR binding (#102) supported
establish_connection+Model.where(...).to_a/count/create. The stage-4b conformance app additionally needsActiveRecord::Schema.define, thecreate_tableDSL,class User < ActiveRecord::Base,create!, andwhere(...).order(...).to_arendered through ERB. Those now work.Added to the binding
ActiveRecord::Schema.define { create_table … }— runs a DDL block whosecreate_tablerendersCREATE TABLE(+CREATE INDEX) and executes it through the connected sqlite3 adapter (the same pathcreate/whereuse). Column DSL:string/integer/float/boolean/text/datetime/timestamp/date/time/binary/decimal/bigint,timestamps,references/belongs_to, genericcolumn,t.index,primary_key, and theid:/primary_key:create_table options; plusadd_index/add_column/execute.class User < ActiveRecord::Baseas a working model — table name inferred viaactiverecord.Tableize(or set withself.table_name =), answeringall/where/order/count/first/find/create/create!by lazily resolving a cached model and reusing the existing chainableRelation. Records expose their columns as dynamic reader/writer accessors so an AR-loaded row renders throughu.name.Library
Uses new
Tableize/Pluralizeinflectors andTableDef.PrimaryKeyadded in go-ruby-activerecord (go-ruby-activerecord/activerecord#1), re-pinned here.Asserted stage-4b response
GET /users?min=26→status=200,body=<ul><li>amy (30)</li><li>cat (40)</li></ul>.Tests
100% coverage on the new binding code; full
internal/vmsuite green underTZ=UTC; schema Ruby source uses no host paths (Windows-safe). Depends on go-ruby-activerecord/activerecord#1 (merge + tag/re-pin before this).🤖 Generated with Claude Code