Skip to content

Instantly share code, notes, and snippets.

@malachaifrazier
Last active June 1, 2022 17:36
Show Gist options
  • Save malachaifrazier/5605989677a56f43fed6e47a2e956fb2 to your computer and use it in GitHub Desktop.
Save malachaifrazier/5605989677a56f43fed6e47a2e956fb2 to your computer and use it in GitHub Desktop.
Rail 7 generators with my defaults

Rails new

rails new app-name -d postgresql -j esbuild --css bootstrap

New system tests

bin/rails g system_test quotes

Run all system tests

bin/rails test:system --trace

Run specific systems test by line num

bin/rails test test/system/quotes_test.rb:8

Gen new model w/name col as string

bundle exec rails generate model MODEL name:string

Gen controller w/single action and skipping routes flag

bin/rails generate controller Articles index --skip-routes

Gen controller scaffold CRUD

bin/rails generate scaffold_controller Quotes crud
  • [WARNING] The model name 'Quotes' was recognized as a plural, using the singular 'Quote' instead. Override with --force-plural or setup custom inflection rules for this noun before running the generator.

  • The name 'QuotesHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative or use --skip-collision-check or --force to skip this check and run this generator again

Create development data from fixtures files

bin/rails db:fixtures:load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment