From 90d50b0c7c118e2b5aa076069c9b2990e196c24b Mon Sep 17 00:00:00 2001 From: Joel Drapper Date: Sun, 17 Mar 2024 18:21:31 +0000 Subject: [PATCH] Update method_missing.rb Co-Authored-By: Seth Horsley <4959521+iseth@users.noreply.github.com> --- lib/phlex/rails/html/method_missing.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/phlex/rails/html/method_missing.rb b/lib/phlex/rails/html/method_missing.rb index 51975d65..85ebbd6e 100644 --- a/lib/phlex/rails/html/method_missing.rb +++ b/lib/phlex/rails/html/method_missing.rb @@ -1,9 +1,13 @@ +# frozen_string_literal: true + module Phlex::Rails::HTML::MethodMissing def method_missing(name, *args, **kwargs, &block) return super unless helpers.respond_to?(name) + const_name = name.to_s.gsub("?", "") module_name = Phlex::Rails::Helpers.constants.find { |mod| mod.to_s.underscore.gsub("domid", "dom_id") == const_name } return super unless module_name + raise NoMethodError, "Try including `Phlex::Rails::Helpers::#{module_name}` in your class." end end