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
1 changed files with 6 additions and 0 deletions

View File

@ -1,4 +1,10 @@
# frozen_string_literal: true
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