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

Gracefully degrade when ActionMailer::Base#params is nil #47101

Merged
merged 1 commit into from
Jan 23, 2023

Commits on Jan 21, 2023

  1. Gracefully degrade when ActionMailer::Base#params is nil

    Prior to this change, access to `params` on `ActionMailer::Base`
    instances prior to being decorated by `ActionMailer::Parameterized.with`
    calls results in a `NoMethodError`:
    
    ```
    Error:
    ParameterizedTest#test_degrade_gracefully_when_.with_is_not_called:
    NoMethodError: undefined method `[]' for nil:NilClass
    
      before_action { @Inviter, @invitee = params[:inviter], params[:invitee] }
                                                 ^^^^^^^^^^
    ```
    
    This change modifies the `attr_accessor :params` to be an `attr_writer`
    paired with a `params` method that assigns `@params` to an empty `Hash`
    whenever it's accessed without being otherwise initialized.
    seanpdoyle committed Jan 21, 2023
    Configuration menu
    Copy the full SHA
    6fea9a0 View commit details
    Browse the repository at this point in the history