Module: ComponentParty::ImporterHelper
- Defined in:
- lib/component_party/importer_helper.rb
Overview
Exposes component rendering methods to Rails views
Instance Method Summary collapse
-
#import_component(local_component_name, opts = {}) ⇒ void
Description of #import_component.
Instance Method Details
#import_component(local_component_name, opts = {}) ⇒ void
Description of #import_component
10 11 12 13 14 15 16 17 18 |
# File 'lib/component_party/importer_helper.rb', line 10 def import_component(local_component_name, opts = {}) raise "No path informed when importing component #{local_component_name}" if opts[:path].blank? component_to_render_path = get_full_component_path(opts[:path]) define_singleton_method(local_component_name) do |**args| render(component: component_to_render_path, view_model_data: args, custom_view_model: (opts[:custom_view_model] || false)) end end |