diff --git a/lib/rails3-jquery-autocomplete/simple_form_plugin.rb b/lib/rails3-jquery-autocomplete/simple_form_plugin.rb index 36595517..aad2134d 100644 --- a/lib/rails3-jquery-autocomplete/simple_form_plugin.rb +++ b/lib/rails3-jquery-autocomplete/simple_form_plugin.rb @@ -2,7 +2,7 @@ module SimpleForm module Inputs class AutocompleteInput < Base def input - @builder.autocomplete_field(attribute_name, options[:url], input_html_options) + @builder.autocomplete_field(attribute_name, options[:url], input_html_options.merge(update_elements(options[:update_elements]))) end protected @@ -14,6 +14,10 @@ def limit def has_placeholder? placeholder_present? end + + def update_elements(elements) + {'data-update-elements' => elements.to_json} + end end end end