Skip to content

Commit

Permalink
Corrected how the railtie gets annotate_rendered_view_with_filenames
Browse files Browse the repository at this point in the history
The way we were getting annotate_rendered_view_with_filenames from rails
wasn't working.

I've changed it to get the config option directly from the rails config,
which is hopefully a bit simpler and does not depend on any loading
order.
  • Loading branch information
iainbeeston committed Mar 15, 2024
1 parent 8f77d96 commit 686fa48
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/better_html/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

module BetterHtml
class Railtie < Rails::Railtie
initializer "better_html.better_erb.initialization" do
initializer "better_html.better_erb.initialization" do |app|
BetterHtml::BetterErb.prepend!

ActiveSupport.on_load(:action_view) do
BetterHtml.config.annotate_rendered_view_with_filenames = ActionView::Base.annotate_rendered_view_with_filenames
end
action_view_config = app.config.action_view
BetterHtml.config.annotate_rendered_view_with_filenames = action_view_config.annotate_rendered_view_with_filenames
end
end
end

0 comments on commit 686fa48

Please sign in to comment.