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

Added flash types are listed in controller action methods #33593

Closed
Bodacious opened this issue Aug 12, 2018 · 5 comments · Fixed by #42768
Closed

Added flash types are listed in controller action methods #33593

Bodacious opened this issue Aug 12, 2018 · 5 comments · Fixed by #42768

Comments

@Bodacious
Copy link
Contributor

Bodacious commented Aug 12, 2018

Steps to reproduce

  1. Subclass ActionController::Base
  2. Add an additional flash type via add_flash_types
  3. Inspect that controller's action_methods
  4. You'll see your flash type included in that set
# frozen_string_literal: true

begin
  require "bundler/inline"
rescue LoadError => e
  $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
  raise e
end

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails"
end

require "action_controller/railtie"

class TestApp < Rails::Application
  config.root = __dir__
  secrets.secret_key_base = "secret_key_base"

  config.logger = Logger.new($stdout)
  Rails.logger  = config.logger

  routes.draw do
    get "/" => "test#index"
  end
end

class TestController < ActionController::Base
  add_flash_types :hype
end

require "minitest/autorun"
require "rack/test"

class BugTest < Minitest::Test
  include Rack::Test::Methods

  def test_returns_success
    assert TestController.action_methods.include?('hype')
  end
end

Expected behavior

Flash types should not be listed as action methods.

Actual behavior

Flash types are indeed being listed as action methods.

System configuration

Rails version:
Observed in 5.2.1 and edge.

Ruby version:
2.5.1

@p8
Copy link
Member

p8 commented Jul 10, 2021

Hi @Bodacious, are you still interested in fixing this?
If so, could you resubmit your PR based on main instead of master?
Thanks!

@Bodacious
Copy link
Contributor Author

Bodacious commented Jul 10, 2021 via email

@p8
Copy link
Member

p8 commented Jul 10, 2021

Great! 😄

@Bodacious
Copy link
Contributor Author

@p8 I've submitted a fresh PR this morning. Thanks for chasing me up on this.

@p8
Copy link
Member

p8 commented Jul 13, 2021

Thanks @Bodacious !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants