Module: ActiveScaffold::Bridges::RecordSelect::Helpers::SearchColumnHelpers
- Defined in:
- lib/active_scaffold/bridges/record_select/helpers.rb
Instance Method Summary collapse
- #active_scaffold_search_record_select(column, options, ui_options: column.options) ⇒ Object
- #field_search_record_select_value(column, value, ui_options: column.options) ⇒ Object
Instance Method Details
#active_scaffold_search_record_select(column, options, ui_options: column.options) ⇒ Object
69 70 71 72 |
# File 'lib/active_scaffold/bridges/record_select/helpers.rb', line 69 def active_scaffold_search_record_select(column, , ui_options: column.) value = field_search_record_select_value(column, [:value], ui_options: ) active_scaffold_record_select([:object], column, .except(:value), value, [:multiple], ui_options: ) end |
#field_search_record_select_value(column, value, ui_options: column.options) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/active_scaffold/bridges/record_select/helpers.rb', line 74 def field_search_record_select_value(column, value, ui_options: column.) return if value.blank? if [:multiple] column.association.klass.find value.select(&:present?).collect!(&:to_i) else column.association.klass.find(value.to_i) end rescue StandardError => e logger.error "#{e.class.name}: #{e.} -- Sorry, we are not that smart yet. Attempted to restore search values to search fields :#{column.name} in #{controller.class}" raise e end |