Class: ActionController::Base
- Defined in:
- lib/reactive-ruby/rails/controller_helper.rb
Overview
adds render_component helper to ActionControllers
Instance Method Summary collapse
Instance Method Details
#render_component(*args) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/reactive-ruby/rails/controller_helper.rb', line 6 def render_component(*args) @component_name = (args[0].is_a? Hash) || args.empty? ? params[:action].camelize : args.shift @render_params = args.shift || {} = args[0] || {} render inline: '<%= react_component @component_name, @render_params %>', layout: .key?(:layout) ? [:layout].to_s : :default end |