Method: Tolaria::FormBuildable#image_association_select

Defined in:
lib/tolaria/form_buildable.rb

#image_association_select(method, collection, value_method, text_method, preview_url_method, options = {}) ⇒ Object

Creates a searchable_select that also shows a dynamic image preview of the selected record. Useful for previewing images or avatars chosen by name. preview_url_method should be a method name to call on the associated model instance that returns a fully-qualified URL to the image preview.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/tolaria/form_buildable.rb', line 35

def image_association_select(method, collection, value_method, text_method, preview_url_method, options = {})
  render(partial:"admin/shared/forms/image_association_select", locals: {
    f: self,
    method: method,
    collection: collection,
    value_method: value_method,
    text_method: text_method,
    preview_url_method: preview_url_method,
    options: options,
    html_options: options,
  })
end