From 292b5b607da3122410662e26147f687ec5c7b751 Mon Sep 17 00:00:00 2001 From: Roman Simecek Date: Fri, 25 Nov 2011 11:57:40 +0100 Subject: [PATCH] Option :update_elements for SimpleForm implemented. --- lib/rails3-jquery-autocomplete/simple_form_plugin.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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