From eb911157822857a7309aafcbddcb3cdc9c7f6738 Mon Sep 17 00:00:00 2001 From: kfl62 Date: Tue, 17 Mar 2009 21:22:29 +0200 Subject: [PATCH] auto_complete field value even if foreign_key --- lib/forms/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/forms/application_helper.rb b/lib/forms/application_helper.rb index 9f5e42a..fa43d5c 100644 --- a/lib/forms/application_helper.rb +++ b/lib/forms/application_helper.rb @@ -87,7 +87,7 @@ def last_row_for(object_name,method, options = {}) def td_auto_complete_search(object_name,method, options = {}) habtm_value = "" if method.to_s.split("_").last == "id" - habtm_field = method.to_s.gsub(/_id/, "") + habtm_field = options[:search_object].underscore habtm_method = options[:informal] ? options[:informal] : options[:search_method] habtm_value = options[:object].send(habtm_field).send(habtm_method) rescue habtm_value = "" end