Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate application record generator description to orm hooked generator. #45975

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

gmcgibbon
Copy link
Member

Motivation / Background

Delegates usage docs for bin/rails g application_record to the ORM-hooked generator (by default Active Record).

Detail

This allows ORM-hooked app record generators to specify their own usage descriptions.

Before:

% bin/rails g application_record -h
Running via Spring preloader in process 36026
Usage:
  rails generate application_record [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
      [--skip-collision-check], [--no-skip-collision-check]  # Skip collision check
  -o, --orm=NAME                                             # ORM to be invoked
                                                             # Default: active_record

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

Description:
    Create rails files for application_record generator.

After:

% bin/rails g application_record -h
Running via Spring preloader in process 36172
Usage:
  rails generate application_record [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
      [--skip-collision-check], [--no-skip-collision-check]  # Skip collision check
  -o, --orm=NAME                                             # ORM to be invoked
                                                             # Default: active_record

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

Description:
    Generates an `ApplicationRecord` base class for other models to inherit from.

Example:
    `bin/rails generate application_record`

    This generates the base class. A test is not generated because no
    behaviour is included in `ApplicationRecord` by default.

Additional information

Similar to the work done to delegate generator descriptions to the ORM-hooked model generator in #45315

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • There are no typos in commit messages and comments.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Feature branch is up-to-date with main (if not - rebase it).
  • Pull request only contains one commit for bug fixes and small features. If it's a larger feature, multiple commits are permitted but must be descriptive.
  • Tests are added if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.
  • PR is not in a draft state.
  • CI is passing.

@gmcgibbon gmcgibbon force-pushed the application_record_generator_usage branch from ddb6cfa to f54cbe1 Compare September 8, 2022 23:19
@gmcgibbon gmcgibbon merged commit 2b42bbc into rails:main Sep 9, 2022
@gmcgibbon gmcgibbon deleted the application_record_generator_usage branch September 9, 2022 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants