Class: Impulse::AjaxSelectComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/impulse/ajax_select_component.rb

Instance Method Summary collapse

Methods inherited from ApplicationComponent

generate_id

Methods included from Helpers::AttributesHelper

#merge_attributes

Constructor Details

#initialize(object_name, method_name, value_method, text_method, selected: nil, **system_args) ⇒ AjaxSelectComponent

Returns a new instance of AjaxSelectComponent.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
# File 'app/components/impulse/ajax_select_component.rb', line 6

def initialize(object_name, method_name, value_method, text_method, selected: nil, **system_args)
  @object_name = object_name
  @method_name = method_name
  @value_method = value_method
  @text_method = text_method
  @selected = selected
  @system_args = system_args

  raise ArgumentError, "`src` attribute is missing" unless @system_args[:src]
end