Class: BrainDamage::View::Input::AutocompletableSimpleSelection

Inherits:
Autocompletable show all
Defined in:
lib/generators/brain_damage/lib/views/inputs/autocompletable_simple_selection.rb

Instance Attribute Summary

Attributes inherited from Templateable::FieldTemplateable

#partial_html, #type

Attributes inherited from Templateable::Base

#inner_html, #options, #template_file

Instance Method Summary collapse

Methods inherited from Autocompletable

#display_method, #target, #url, #value_method

Methods inherited from Base

#dir, #tag_options

Methods inherited from Templateable::FieldTemplateable

#empty_haml_path, #initialize, #label_guard?, #method_missing, #render, #show?, #show_label?

Methods inherited from Templateable::Base

#indent, #initialize, #method_missing, #render, #render_erb_file, #render_erb_string, #render_template_file

Constructor Details

This class inherits a constructor from BrainDamage::Templateable::FieldTemplateable

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BrainDamage::Templateable::FieldTemplateable

Instance Method Details

#input_nameObject



15
16
17
# File 'lib/generators/brain_damage/lib/views/inputs/autocompletable_simple_selection.rb', line 15

def input_name
  @options[:input_name] || render_erb_string("<%= singular_table_name %>[<%= name %>_id]")
end

#partial_to_showObject



11
12
13
# File 'lib/generators/brain_damage/lib/views/inputs/autocompletable_simple_selection.rb', line 11

def partial_to_show
  @options[:partial_to_show] || "#{target}/autocompletable/simple_selection"
end

#valueObject



7
8
9
# File 'lib/generators/brain_damage/lib/views/inputs/autocompletable_simple_selection.rb', line 7

def value
  "{ display: '\#{#{singular_table_name}.#{name}.try(:#{display_method})}', value: '\#{#{singular_table_name}.#{name}.try(:#{value_method})}'}"
end