Ruby on Rails Monday, April 10, 2017

While playing around with gem `traceroute` (0.5.0) I noticed that my additional flash types:

# application_controller.rb
# ...
add_flash_types :success
add_flash_types :error
# ...

are "leaking" into public scope of every controller descendent of ApplicationController:

I wonder if add_flash_types should define the new methods as protected, since it might lead into conflicts with actual controller actions.
You can see this "leaking" with the gem or just with this: { |ctrl| { |action| + "#" + action

This is trivial to accomplish - simply change it to:

define_method(type) do
protected type
helper_method type

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment