Added helper for referencing components from erbs

This commit is contained in:
James Patrick 2020-05-15 20:36:23 -04:00
parent ac1ef00c5a
commit 15fa92fd36

View File

@ -1,4 +1,10 @@
# frozen_string_literal: true # frozen_string_literal: true
module ApplicationHelper module ApplicationHelper
def component(component_name, locals = {}, &block)
name = component_name.split("_").first
render("components/#{name}/#{component_name}", locals, &block)
end
alias c component
end end