Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Address PR #14123 review comments
Damian Legawiecd8c8d64ab1a6
diff --git a/.claude/settings.local.json b/.claude/settings.local.jsonindex 3812559a68..b6d79e6d03 100644--- a/.claude/settings.local.json+++ b/.claude/settings.local.json@@ -11,12 +11,9 @@"WebSearch","Task","mcp__*",- "Read(//private/tmp/**)",- "Bash(cp server/.env /tmp/server-env-backup)","Bash(rm -rf server)","Bash(git clone *)",- "Bash(rm -rf server/.git server/.gitignore)",- "Bash(cp /tmp/server-env-backup server/.env)"+ "Bash(rm -rf server/.git server/.gitignore)"],"deny": ["Bash(sudo *)",diff --git a/docs/developer/cli/quickstart.mdx b/docs/developer/cli/quickstart.mdxindex 85aaed0655..427a649ce6 100644--- a/docs/developer/cli/quickstart.mdx+++ b/docs/developer/cli/quickstart.mdx@@ -54,6 +54,16 @@ Stop all services.spree stop```+### `spree restart`++Restart `web` and `worker` in place — same image, same volumes, fresh Rails process. Good for `config/initializers/*.rb` changes or anything Zeitwerk doesn't auto-reload.++```bash+spree restart+```++Not appropriate for Gemfile changes (use `spree bundle install` then `spree stop && spree dev`), Dockerfile / `.ruby-version` changes (use `spree build`), or compose file changes (use `spree stop && spree dev`).+### `spree update`Pull the latest Spree Docker image and recreate containers. Migrations run automatically on startup.@@ -62,6 +72,34 @@ Pull the latest Spree Docker image and recreate containers. Migrations run automspree update```+### `spree build`++Rebuild the dev image after Dockerfile or `.ruby-version` changes. Only relevant after `spree eject`.++```bash+spree build+spree build --reset-bundle # Also drop the bundle_cache volume so gems re-seed+spree build --yes # Skip confirmation prompts (for CI)+```++`spree bundle add` does NOT require a rebuild — gems land in the `bundle_cache` volume which survives image rebuilds.++`--reset-bundle` only drops `bundle_cache`. Postgres, Redis, Meilisearch, and storage volumes are preserved.++### `spree upgrade`++Walk a Spree version upgrade end-to-end inside the dev stack. Runs `bundle update`, applies pending migrations, then walks the version-specific data backfills from the upgrade manifest.++```bash+spree upgrade # Detect target, run the full sequence interactively+spree upgrade --plan # Print the plan without executing (DRY_RUN=1)+spree upgrade --to 5.5 # Cap the walk at a specific target version+spree upgrade --step <id> # Re-run a single step idempotently (skips bundle + migrate)+spree upgrade --yes # Skip the per-step prompts+```++Production upgrades only need the third stage — `bundle install` and `db:migrate` happen in your deploy pipeline. The CLI runs all three for local development. See [Upgrades](/developer/upgrades) for the manual production path.+### `spree eject`Switch from the prebuilt Docker image to building from your local `backend/` directory. This lets you customize the Rails app — add gems, override models, add migrations, etc.@@ -135,3 +173,113 @@ spree api-key create --name "Storefront" --type publishable # Store API keyspree api-key create --name "Admin" --type secret # Admin API keyspree api-key revoke <id> # Revoke a key```++## Dev workflow commands++These mirror the Rails commands you'd run if you were running the app directly on your host — but each is routed through `docker compose exec` against the running stack.++### `spree generate`++Run a Rails generator inside the container. Same arguments as `bin/rails generate`.++```bash+spree generate model Brand name:string slug:string+spree generate migration AddPositionToProducts position:integer+spree generate spree:api_resource Brand name:string slug:string # The Spree v3-conformant generator+```++See [Generators](/developer/customization/generators) for the Spree-specific generators (`spree:model`, `spree:api_resource`) that extend Rails' built-in ones with Spree conventions.++### `spree migrate`++Install pending Spree migrations from gems, then run `db:migrate`.++```bash+spree migrate+```++Equivalent to `spree rails spree:install:migrations db:migrate` — a shortcut for the canonical post-update sequence.++### `spree db:reset`++Drop, recreate, and seed the database. **Destructive** — wipes everything. Asks for confirmation.++```bash+spree db:reset+spree db:reset --yes # Skip confirmation (for CI)+```++### `spree db:console`++Open a database console (`bin/rails dbconsole`) connected to the dev Postgres.++```bash+spree db:console+```++### `spree routes`++Show Rails routes. All flags pass through to `bin/rails routes`.++```bash+spree routes+spree routes -g products # Filter by pattern+spree routes -c Spree::Api::V3::Store::ProductsController # Filter by controller+spree routes --expanded+```++## Running things inside the container++These are passthrough commands — anything after the subcommand reaches the inner Rails/Bundle/Rake invocation as-is. Useful for ad-hoc commands that don't have a dedicated wrapper.++### `spree exec`++Run an arbitrary command inside the `web` container.++```bash+spree exec ls -la+spree exec env+spree exec ruby -v+```++### `spree rails`++Run a `bin/rails` command.++```bash+spree rails c # Console (alias of `spree console`)+spree rails routes -g products # Alias of `spree routes -g products`+spree rails runner "puts Spree::Product.count"+spree rails new_subcommand arg1 arg2+```++### `spree bundle`++Run a `bundle` command. Gems land in the `bundle_cache` volume (no image rebuild needed).++```bash+spree bundle install+spree bundle add stripe+spree bundle update spree_core+spree bundle outdated+```++### `spree rake`++Run a Rake task.++```bash+spree rake -T # List tasks+spree rake spree:upgrade # Run the version-specific data backfills+spree rake spree:upgrade DRY_RUN=1 # Same, plan only+```++### `spree task`++Shortcut for `bin/rails <task>` (Spree-style rake tasks registered as Rails tasks).++```bash+spree task load_sample_data+spree task spree:price_history:seed+spree task spree:price_history:prune+```diff --git a/docs/developer/upgrades/5.4-to-5.5.mdx b/docs/developer/upgrades/5.4-to-5.5.mdxindex 5d5c024e6d..16d22f87c6 100644--- a/docs/developer/upgrades/5.4-to-5.5.mdx+++ b/docs/developer/upgrades/5.4-to-5.5.mdx@@ -7,7 +7,7 @@ description: Step-by-step guide to upgrading a Spree 5.4 application to Spree 5.Before proceeding to upgrade, please ensure you're at [Spree 5.4](/developer/upgrades/5.3-to-5.4).</Info>-The upgrade is usually+The upgrade is usually completed in five steps:1. **Update the Ruby gems** which power Spree API2. **Run database migrations** — to migrate your existing schema to the new versiondiff --git a/docs/plans/5.5-agent-skills.md b/docs/plans/5.5-agent-skills.mdindex 64dea76990..45e2bb91a7 100644--- a/docs/plans/5.5-agent-skills.md+++ b/docs/plans/5.5-agent-skills.md@@ -35,7 +35,7 @@ This is **for Spree users, not monorepo contributors.** Skills reference `backen### Standalone repo layout (github.com/spree/agent-skills)-```+```textagent-skills/├── .claude-plugin/│ └── plugin.json # Claude Code plugin manifest (name: "spree", version, description)@@ -136,7 +136,7 @@ The scaffold **does not bundle skills** any more. Instead:2. Removes `src/skills.ts` and the `writeClaudeArtifacts(projectDir)` call from `src/scaffold.ts`.3. Adds a post-scaffold hint to the success message:- ```+ ```textAgent skills (optional)npx skills add spree/agent-skills# Adds 23 Spree skills to whichever AI agent(s) you usediff --git a/docs/plans/spree-dev-cli-and-generators.md b/docs/plans/spree-dev-cli-and-generators.mdindex a4beb88bca..25513d013d 100644--- a/docs/plans/spree-dev-cli-and-generators.md+++ b/docs/plans/spree-dev-cli-and-generators.md@@ -8,7 +8,7 @@`create-spree-app` scaffolds:-```+```textmy-spree-app/├── backend/ # the Rails app (cloned from spree-starter)│ ├── Dockerfile@@ -399,7 +399,7 @@ Today's data tasks are *implicitly* version-scoped — `spree/core/lib/tasks/chaThe mapping uses **directory convention + tiny per-version manifest**, with the rake tasks themselves unchanged:-```+```textcore/lib/spree/upgrades/├── 5_4_to_5_5/│ ├── manifest.yml@@ -457,7 +457,7 @@ Why a YAML manifest rather than a Ruby DSL or rake task metadata: the manifest i### CLI surface-```+```bashspree upgrade # detect from → to from Gemfile.lock and run the manifest interactivelyspree upgrade --to 5.5 # explicit target (when you want to step rather than jump)spree upgrade --plan # print the plan, don't execute (good for PR description / runbook)@@ -506,7 +506,7 @@ The CLI's `spree generate` proxies to `bin/rails g spree:<name>`. The actual sca### Generator surface-```+```textspree:api_resource NAME [field[:type[:index|:uniq|:null|:default=…]]…] [options]```@@ -532,7 +532,7 @@ spree:api_resource NAME [field[:type[:index|:uniq|:null|:default=…]]…] [optiFor `spree generate api_resource Brand name:string:uniq active:boolean:default=true`:-```+```textcore/app/models/spree/brand.rb (owned-once)core/db/migrate/<ts>_create_spree_brands.rb (append-only)@@ -749,6 +749,6 @@ These were open and now aren't, written down so future-me doesn't reopen them:1. **~~`db/schema.rb` write permissions from the dev container.~~ Resolved.** Originally framed as a real problem — turns out it isn't. Every CLI command goes through `docker compose exec web …`, which means file writes happen as the container's default user (UID 1000, `rails`). On macOS, Docker Desktop and OrbStack do UID mapping at the VM boundary, so bind-mount writes always appear as the host user regardless of container UID. On Linux, the host user is typically UID 1000 (Ubuntu/Debian/Fedora default), so the UIDs match. The bundle/tmp/storage volumes are docker-managed (not bind-mounted), so the host never touches them — initial UID-1000 ownership inside the container is exactly what's wanted. The compose stays simple: no `user:` override, no init service, no entrypoint chown. The CLI exporting `HOST_UID`/`HOST_GID` is only needed for the Linux multi-user edge case (host user not UID 1000) and is deferred until someone actually hits it.-2. **`spree-starter` PR.** The new compose ships from `spree-starter`'s `backend/` template; the local clone is at `/Users/damian/github/spree-starter`. A sibling PR lands the new `docker-compose.dev.yml` there. (The monorepo `server/` directory is dev-only for the gems and doesn't need separate consideration.)+2. **`spree-starter` PR.** The new compose ships from `spree-starter`'s `backend/` template. A sibling PR lands the new `docker-compose.dev.yml` there. (The monorepo `server/` directory is dev-only for the gems and doesn't need separate consideration.)3. **Idempotency helper for backfill tasks.** The existing `backfill_*` family will get `where.not(<col>: nil)` guards as part of the Track 2c prep audit. Whether to extract a shared helper (`Spree::Upgrades::Idempotent.backfill(scope, &block)`) or keep guards per-task is style preference; lean per-task — explicit skip conditions read better than a clever wrapper for something that runs once per upgrade.diff --git a/package.json b/package.jsonindex 077fd7b7c0..9d3c3882a9 100644--- a/package.json+++ b/package.json@@ -16,10 +16,10 @@"server:start": "SPREE_PATH=$PWD docker compose -f server/docker-compose.dev.yml -f scripts/docker-compose.edge.yml up -d --force-recreate web worker","server:restart": "SPREE_PATH=$PWD docker compose -f server/docker-compose.dev.yml -f scripts/docker-compose.edge.yml restart web worker","server:stop": "SPREE_PATH=$PWD docker compose -f server/docker-compose.dev.yml -f scripts/docker-compose.edge.yml down",- "server:console": "cd server && pnpm exec spree console",- "server:logs": "cd server && pnpm exec spree logs",- "server:seed": "cd server && pnpm exec spree rails db:seed",- "server:load_sample_data": "cd server && pnpm exec spree task load_sample_data"+ "server:console": "cd server && spree console",+ "server:logs": "cd server && spree logs",+ "server:seed": "cd server && spree rails db:seed",+ "server:load_sample_data": "cd server && spree task load_sample_data"},"devDependencies": {"@biomejs/biome": "^2.4.14",diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.tsindex a6e7477249..a330f240d7 100644--- a/packages/cli/src/commands/build.ts+++ b/packages/cli/src/commands/build.ts@@ -2,20 +2,27 @@ import fs from 'node:fs'import path from 'node:path'import * as p from '@clack/prompts'import type { Command } from 'commander'+import { execa } from 'execa'import pc from 'picocolors'import { detectProject } from '../context.js'import { dockerCompose } from '../docker.js'-// Rebuild the dev image. Needed after Dockerfile or .ruby-version changes;-// `spree bundle add` does NOT require this — gems land in the bundle_cache-// volume which survives image rebuilds.-//-// --reset-bundle wipes the bundle_cache volume so the new image's gem-// baseline gets re-seeded. Use when you bumped .ruby-version (gems compiled-// against the old Ruby won't load against the new one).-//-// Targets docker-compose.dev.yml explicitly when present, so this works-// before `spree eject` too (eject collapses the two files into one).+/**+ * Register the `spree build` command on the CLI program.+ *+ * Rebuilds the dev image. Needed after Dockerfile or .ruby-version changes;+ * `spree bundle add` does NOT require this — gems land in the bundle_cache+ * volume which survives image rebuilds.+ *+ * `--reset-bundle` wipes the bundle_cache volume so the new image's gem+ * baseline gets re-seeded. Use when you bumped .ruby-version (gems compiled+ * against the old Ruby won't load against the new one).+ *+ * Targets docker-compose.dev.yml explicitly when present, so this works+ * before `spree eject` too (eject collapses the two files into one).+ *+ * @param program - The Commander CLI program to register the command on.+ */export function registerBuildCommand(program: Command): void {program.command('build')@@ -41,10 +48,20 @@ export function registerBuildCommand(program: Command): void {const s = p.spinner()s.start('Wiping bundle_cache volume...')- // `docker compose down -v` is portable (no project-name guessing) but- // also tears down all containers. Acceptable: rebuilding the image- // means the user is recreating containers anyway.- await dockerCompose([...composeArgs, 'down', '-v'], ctx.projectDir, { stdio: 'ignore' })+ // Stop containers without -v: `down -v` would also wipe postgres,+ // redis, meilisearch, and storage volumes — destroying dev data+ // and uploads. We only want to drop bundle_cache.+ await dockerCompose([...composeArgs, 'down'], ctx.projectDir, { stdio: 'ignore' })+ // Resolve the compose project name so we can target the namespaced+ // volume directly. Compose derives the project name from the dir+ // (or COMPOSE_PROJECT_NAME); `compose ls --format json` returns+ // whatever it actually uses for THIS compose file.+ const projectName = await resolveComposeProjectName(composeArgs, ctx.projectDir)+ await execa('docker', ['volume', 'rm', `${projectName}_bundle_cache`], {+ cwd: ctx.projectDir,+ stdio: 'ignore',+ reject: false, // Volume may not exist on first build — that's fine+ })s.stop('bundle_cache volume wiped.')}@@ -74,3 +91,30 @@ function composeFileArgs(projectDir: string): string[] {const devCompose = path.join(projectDir, 'docker-compose.dev.yml')return fs.existsSync(devCompose) ? ['-f', 'docker-compose.dev.yml'] : []}++// Returns the compose project name (e.g. `my-spree-app` or whatever+// COMPOSE_PROJECT_NAME / dir basename resolves to). Used to target the+// `<project>_bundle_cache` named volume without guessing.+//+// Falls back to the project directory's basename if the compose ls call+// doesn't find an entry — matches Compose's own default behavior.+async function resolveComposeProjectName(+ composeArgs: string[],+ projectDir: string,+): Promise<string> {+ try {+ const { stdout } = await execa(+ 'docker',+ ['compose', ...composeArgs, 'config', '--format', 'json'],+ { cwd: projectDir },+ )+ const parsed = JSON.parse(stdout) as { name?: string }+ if (parsed.name) return parsed.name+ } catch {+ // Fall through to basename fallback.+ }+ return path+ .basename(projectDir)+ .toLowerCase()+ .replace(/[^a-z0-9_-]/g, '')+}diff --git a/packages/cli/src/commands/restart.ts b/packages/cli/src/commands/restart.tsindex b6ea27315e..4d545a8d2d 100644--- a/packages/cli/src/commands/restart.ts+++ b/packages/cli/src/commands/restart.ts@@ -23,7 +23,14 @@ export function registerRestartCommand(program: Command): void {const s = p.spinner()s.start('Restarting web + worker...')- await dockerCompose(['restart', 'web', 'worker'], ctx.projectDir)- s.stop('Services restarted.')+ try {+ await dockerCompose(['restart', 'web', 'worker'], ctx.projectDir)+ s.stop('Services restarted.')+ } catch (error) {+ // Without this, the spinner stays "live" when the top-level+ // handler prints the error — output lands under a stale prompt.+ s.stop('Restart failed.')+ throw error+ }})}diff --git a/packages/cli/src/commands/routes.ts b/packages/cli/src/commands/routes.tsindex ea44e3297e..a383ce0483 100644--- a/packages/cli/src/commands/routes.ts+++ b/packages/cli/src/commands/routes.ts@@ -2,10 +2,17 @@ import type { Command } from 'commander'import { detectProject } from '../context.js'import { dockerComposeExec } from '../docker.js'-// `bin/rails routes [-g pattern] [-c controller] [--expanded]` passthrough.-// spree routes-// spree routes -g products-// spree routes -c Spree::Api::V3::Store::ProductsController+/**+ * Register the `spree routes` command on the CLI program.+ *+ * Passthrough to `bin/rails routes [-g pattern] [-c controller] [--expanded]`.+ *+ * spree routes+ * spree routes -g products+ * spree routes -c Spree::Api::V3::Store::ProductsController+ *+ * @param program - The Commander CLI program to register the command on.+ */export function registerRoutesCommand(program: Command): void {program.command('routes')diff --git a/packages/cli/src/commands/upgrade.ts b/packages/cli/src/commands/upgrade.tsindex 20ce91ad48..3d75fa5b76 100644--- a/packages/cli/src/commands/upgrade.ts+++ b/packages/cli/src/commands/upgrade.ts@@ -4,31 +4,38 @@ import pc from 'picocolors'import { detectProject } from '../context.js'import { dockerComposeExec } from '../docker.js'-// `spree upgrade` is a dev-friendly sequencer around the real upgrade flow:-//-// 1. bundle update (universal — bumps spree_core etc.)-// 2. db:migrate (universal — applies the new gem's migrations)-// 3. spree:upgrade (version-specific — runs the rake-only manifest)-//-// On production, step 3 is what your deploy pipeline runs after `bundle-// install` + `db:migrate` happen there. Steps 1 and 2 are handled by your-// platform (Heroku release phase, K8s init container, Render auto-migrate,-// Capistrano deploy hook), not by this CLI.-//-// Local dev: this command runs all three for you. On a clean stack the-// total time is dominated by `bundle update` (network + native ext build).-//-// Flags map to env vars on the inner rake task so the same args work in-// both surfaces:-// --plan DRY_RUN=1 (also skips steps 1 + 2)-// --step <id> STEP=<id>-// --to <version> TO=<version>-// --yes no flag — skips the per-step prompt-//-// What this CLI deliberately does NOT do: schedule cron jobs, review-// breaking changes, tune reservation TTLs. Those are in-// docs/developer/upgrades/<v>.mdx and the manifest's `notes` text; we-// print the docs URL at the end so the operator knows where to look.+/**+ * Register the `spree upgrade` command on the CLI program.+ *+ * Dev-friendly sequencer around the real upgrade flow:+ *+ * 1. bundle update (universal — bumps spree_core etc.)+ * 2. db:migrate (universal — applies the new gem's migrations)+ * 3. spree:upgrade (version-specific — runs the rake-only manifest)+ *+ * On production, step 3 is what your deploy pipeline runs after `bundle+ * install` + `db:migrate` happen there. Steps 1 and 2 are handled by your+ * platform (Heroku release phase, K8s init container, Render auto-migrate,+ * Capistrano deploy hook), not by this CLI.+ *+ * Local dev: this command runs all three for you. On a clean stack the+ * total time is dominated by `bundle update` (network + native ext build).+ *+ * Flags map to env vars on the inner rake task so the same args work in+ * both surfaces:+ *+ * --plan DRY_RUN=1 (also skips steps 1 + 2)+ * --step <id> STEP=<id>+ * --to <version> TO=<version>+ * --yes no flag — skips the per-step prompt+ *+ * What this CLI deliberately does NOT do: schedule cron jobs, review+ * breaking changes, tune reservation TTLs. Those are in+ * docs/developer/upgrades/<v>.mdx and the manifest's `notes` text; we+ * print the docs URL at the end so the operator knows where to look.+ *+ * @param program - The Commander CLI program to register the command on.+ */export function registerUpgradeCommand(program: Command): void {program.command('upgrade')@@ -59,7 +66,9 @@ export function registerUpgradeCommand(program: Command): void {// Closing reminder: the manifest only covers rake-runnable steps.// Anything human (cron scheduling, breaking-change review) is in// the upgrade doc — point there so the operator doesn't forget.- printPostUpgradeReminder()+ // Skipped on --plan because nothing actually ran — the "next steps"+ // reminder would be misleading.+ if (!flags.plan) printPostUpgradeReminder()})}diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.tsindex 4d678fa35d..8505285fd5 100644--- a/packages/cli/src/index.ts+++ b/packages/cli/src/index.ts@@ -28,7 +28,7 @@ import { registerUserCommand } from './commands/user.js'const program = new Command().name('spree').description('CLI for managing Spree Commerce projects')- .version('2.0.0-beta.6')+ .version('2.0.0')// Required by passThroughOptions on subcommands (exec/rails/bundle/rake/task)// so flags like `ls -la` or `bin/rails routes -g foo` reach the inner command// instead of being parsed as options of the spree subcommand.diff --git a/spree/core/lib/generators/spree/api_resource/api_resource_generator.rb b/spree/core/lib/generators/spree/api_resource/api_resource_generator.rbindex ddb029a5ec..74e09401fd 100644--- a/spree/core/lib/generators/spree/api_resource/api_resource_generator.rb+++ b/spree/core/lib/generators/spree/api_resource/api_resource_generator.rb@@ -326,7 +326,14 @@ module Spree# the namespace's opening line.opening = " namespace :#{namespace} do\n"new_block = "#{BEGIN_MARKER}\n#{route_line}\n#{END_MARKER}\n\n"- File.write(file, content.sub(opening, opening + new_block))+ updated = content.sub(opening, opening + new_block)+ if updated == content+ # The namespace anchor wasn't found — likely a non-default+ # routes.rb. Warn rather than silently claim success.+ say_status :skip, "routes.rb (#{namespace}: namespace block not found — add manually)", :yellow+ return+ end+ File.write(file, updated)say_status :inject, "routes.rb (#{namespace}: sentinels + #{route_line.strip})", :greenendenddiff --git a/spree/core/lib/generators/spree/model/model_generator.rb b/spree/core/lib/generators/spree/model/model_generator.rbindex 76e35d17ea..6909dd63ef 100644--- a/spree/core/lib/generators/spree/model/model_generator.rb+++ b/spree/core/lib/generators/spree/model/model_generator.rb@@ -15,10 +15,15 @@ module Spree[File.expand_path('templates', __dir__), *superclass.source_paths]end+ # Default is the literal expression `Spree.base_class`, not a class+ # constant — Spree.base_class is the swappable lookup that lets apps+ # override the inheritance root via config. The template emits this+ # verbatim. Override with --parent=Spree::SomeOtherClass when you+ # genuinely need to inherit from something else.class_option :parent,type: :string,- default: 'Spree::Base',- desc: 'The parent class for the generated model'+ default: 'Spree.base_class',+ desc: 'The parent class expression for the generated model'class_option :id_prefix,type: :string,@@ -34,7 +39,7 @@ module Spreedefault: false,desc: 'Include Spree::Metafields and Spree::Metadata concerns'- desc 'Creates a new Spree model with prefixed IDs and Spree::Base parent'+ desc 'Creates a new Spree model with prefixed IDs and Spree.base_class parent'# Override to prevent module file from being createddef create_module_filediff --git a/spree/core/lib/generators/spree/model/templates/model.rb.tt b/spree/core/lib/generators/spree/model/templates/model.rb.ttindex d3465bbcd1..f7af89dded 100644--- a/spree/core/lib/generators/spree/model/templates/model.rb.tt+++ b/spree/core/lib/generators/spree/model/templates/model.rb.tt@@ -1,5 +1,5 @@module Spree- class <%= class_name.demodulize %> < <%= parent_class_name.classify %>+ class <%= class_name.demodulize %> < <%= parent_class_name %><% if metafields? -%>include Spree::Metafieldsinclude Spree::Metadata@@ -12,7 +12,11 @@ module Spreehas_prefix_id :<%= id_prefix %><% attributes.select(&:reference?).each do |attribute| -%>- belongs_to :<%= attribute.name %><%= ", polymorphic: true" if attribute.polymorphic? %>, class_name: 'Spree::<%= attribute.name.camelize %>'+<% if attribute.polymorphic? -%>+ belongs_to :<%= attribute.name %>, polymorphic: true+<% else -%>+ belongs_to :<%= attribute.name %>, class_name: 'Spree::<%= attribute.name.camelize %>'+<% end -%><% end -%><% attributes.select(&:rich_text?).each do |attribute| -%>has_rich_text :<%= attribute.name %>@@ -37,8 +41,8 @@ module Spree<% end -%><% end -%><% ransackable = attributes.reject { |a| a.reference? || a.attachment? || a.attachments? || a.rich_text? || a.token? || a.password_digest? }.map(&:name) -%>-<% if ransackable.any? -%>self.whitelisted_ransackable_attributes = %w[<%= ransackable.join(' ') %>]-<% end -%>+ self.whitelisted_ransackable_associations = %w[]+ self.whitelisted_ransackable_scopes = %w[]endend