0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

rails --taskしたら便利コマンドが大量にあったので忘備録

Posted at
rails --tasks

知っているものが大半だが、中には初めて見るものもあるので、ぜひ使ってみたい。

rails about                              # List versions of all Rails frameworks and the environment
rails action_mailbox:ingress:exim        # Relay an inbound email from Exim to Action Mailbox (URL and INGRESS_PASSWORD required)
rails action_mailbox:ingress:postfix     # Relay an inbound email from Postfix to Action Mailbox (URL and INGRESS_PASSWORD required)
rails action_mailbox:ingress:qmail       # Relay an inbound email from Qmail to Action Mailbox (URL and INGRESS_PASSWORD required)
rails action_mailbox:install             # Installs Action Mailbox and its dependencies
rails action_mailbox:install:migrations  # Copy migrations from action_mailbox to application
rails action_text:install                # Copy over the migration, stylesheet, and JavaScript files
rails action_text:install:migrations     # Copy migrations from action_text to application
rails active_storage:install             # Copy over the migration needed to the application
rails annotate_models                    # Add schema information (as comments) to model and fixture files
rails annotate_routes                    # Adds the route map to routes.rb
rails app:template                       # Applies the template supplied by LOCATION=(/path/to/template) or URL
rails app:update                         # Update configs and some other initially generated files (or use just update:configs or update:bin)
rails db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to...
rails db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to dro...
rails db:encryption:init                 # Generate a set of keys for configuring Active Record encryption in a given environment
rails db:environment:set                 # Set the environment value for the database
rails db:fixtures:load                   # Loads fixtures into the current environment's database
rails db:migrate                         # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rails db:migrate:down                    # Runs the "down" for a given migration VERSION
rails db:migrate:redo                    # Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
rails db:migrate:status                  # Display status of migrations
rails db:migrate:up                      # Runs the "up" for a given migration VERSION
rails db:prepare                         # Runs setup if database does not exist, or runs migrations if it does
rails db:reset                           # Drops and recreates all databases from their schema for the current environment and loads the seeds
rails db:rollback                        # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rails db:schema:cache:clear              # Clears a db/schema_cache.yml file
rails db:schema:cache:dump               # Creates a db/schema_cache.yml file
rails db:schema:dump                     # Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` ...
rails db:schema:load                     # Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or...
rails db:seed                            # Loads the seed data from db/seeds.rb
rails db:seed:replant                    # Truncates tables of each database for current environment and loads the seeds
rails db:seed_fu                         # Loads seed data for the current environment
rails db:setup                           # Creates all databases, loads all schemas, and initializes with the seed data (use db:reset to also drop all d...
rails db:version                         # Retrieves the current schema version number
rails jobs:check[max_age]                # Exit with error status if any jobs older than max_age seconds haven't been attempted yet
rails jobs:clear                         # Clear the delayed_job queue
rails jobs:work                          # Start a delayed_job worker
rails jobs:workoff                       # Start a delayed_job worker and exit when all available jobs are complete
rails log:clear                          # Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
rails middleware                         # Prints out your Rack middleware stack
rails remove_annotation                  # Remove schema information from model and fixture files
rails remove_routes                      # Removes the route map from routes.rb
rails restart                            # Restart app by touching tmp/restart.txt
rails rswag:specs:swaggerize             # Generate Swagger JSON files from integration specs
rails rswag:ui:copy_assets[dest]         # TODO
rails secret                             # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)
rails spec                               # Run all specs in spec directory (excluding plugin specs)
rails spec:models                        # Run the code examples in spec/models
rails spec:requests                      # Run the code examples in spec/requests
rails stats                              # Report code statistics (KLOCs, etc) from the application or engine
rails time:zones[country_or_offset]      # List all time zones, list by two-letter country code (`bin/rails time:zones[US]`), or list by UTC offset (`bi...
rails tmp:clear                          # Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screens...
rails tmp:create                         # Creates tmp directories for cache, sockets, and pids
rails yarn:install                       # Install all JavaScript dependencies as specified via Yarn
rails zeitwerk:check                     # Checks project structure for Zeitwerk compatibility
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?