← Home
devise

Rails Generate devise:views

Reference & Command Builder

Published: 2023-12-11
Author: Harrison Broadbent
Type: Reference & Command Builder

Rails Generate Devise:Views

Rails Generate Devise:Views (rails g devise:views) is the Devise Views generator; invoking it will copy all the Devise views into your Rails app, for you to override.

Since Devise is a Rails engine, all it's default views are packaged up in it's gem. You can't edit them directly — instead you need to copy them into your Rails app to override the defaults (that's what this generator does).

By default, devise:views generates a lot of files! Make sure to use the available flags to cut down on extra views. A handy one is the --no-erb flag, which essentially skips generating mailer views (handy if your app only uses OAuth).

If you have multiple Devise models in one app, but don't want them to share views, you can use the View scope field below to set the appropriate model name; Devise will use that value to generate views correctly scoped to a single model.

Devise has a similar generator for controler overrides, Devise:Controllers.

Command Builder for rails g devise:views

rails g devise:views 

View scope (optional, ignore unless required)

Generator Options

Runtime Options

# Command Options
❯ rails g devise:views

Usage:
  rails generate devise:views [SCOPE] [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
      [--skip-collision-check], [--no-skip-collision-check]  # Skip collision check
  -b, [--form-builder=NAME]                                  # Form builder to be used
                                                             # Default: form_for
      [--markerb], [--no-markerb]                            # Generate markerb instead of erb mail views
      [--erb], [--no-erb]                                    # Generate erb mail views
                                                             # Default: true

Devise::Generators::SharedViewsGenerator options:
  -v, [--views=one two three]  # Select specific view directories to generate (confirmations, passwords, registrations, sessions, unlocks, mailer)

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

# Command Description
Description:
  Copies Devise views to your application.