docs: add Rails comparison guide for developers migrating to Marten#357
docs: add Rails comparison guide for developers migrating to Marten#357papilip wants to merge 1 commit into
Conversation
Comprehensive side-by-side comparison covering models, queries, handlers, routes, templates, migrations, sessions, email, CLI, and common gotchas.
| | Migrations | `rails generate migration` | `marten genmigrations` | | ||
| | Console | `rails console` | Crystal doesn't have a REPL | | ||
| | Package manager | Bundler (Gemfile) | Shards (shard.yml) | | ||
| | Test framework | RSpec / Minitest | Crystal spec | |
There was a problem hiding this comment.
It is possible to use with https://github.com/ysbaddaden/minitest.cr
There was a problem hiding this comment.
Thanks for the pointer! After looking at this more closely, minitest.cr can't currently be used as a drop-in for Marten's test helpers: Marten::Spec registers its lifecycle (DB flush, client reset, collected emails) on Crystal Spec's before_suite / after_each hooks, while minitest.cr is a standalone runner with its own lifecycle — so DB and client state would leak between tests.
I've opened #360 to discuss decoupling the test lifecycle from Crystal Spec, which would make minitest.cr (and spectator, etc.) usable with Marten's helpers via thin adapters. Once that's resolved I'll happily update this row.
For now I'll keep Crystal spec as the documented option to avoid misleading readers.
There was a problem hiding this comment.
It is true, but it is not hard to make it work: https://dev.to/miry/make-marten-web-framework-work-with-minitestcr-49kd
Summary
Add a comprehensive comparison guide for Ruby on Rails developers discovering Marten. Placed in
docs/getting-started/rails-comparison.md.Content
Side-by-side comparison covering:
Motivation
Crystal attracts many Ruby developers. A clear mapping between Rails and Marten concepts lowers the learning curve significantly. This guide was written based on real-world experience building a production application with Marten.
Test plan