help with auto_complete

hi,    i've 2 tables as locations and customers. they have "has_many" rel'ship.(1 loc has many custs). i'd gone thru http://trix.pl/blog/ruby-on-rails/auto-complete-for-rails-2-0-tutorial this tutorial that worked fine. but my issue is, i want to have an auto complete text field for customer_id in new location form that will show customer name but store id in the table when created. Can anybody help in this? I hope i've provided enough details...

-Dhaval

Have a look at model_auto_completer:

    http://agilewebdevelopment.com/plugins/model_auto_completer

-- fxn

Xavier Noria wrote:

Xavier Noria wrote:

Do you have a svn client installed?

Xavier Noria wrote:

That's suspicious, do you have the command-line client installed and in the PATH?

-- fxn

Xavier Noria wrote:

Xavier Noria wrote:

Do you have a svn client installed?

yes, i do have it...

That's suspicious, do you have the command-line client installed and in the PATH?

-- fxn

i didn't get you. but i'm using tortoise and could create an SVN for model_auto_completer. now i have model_auto_completer folder with lib,tasks,test etc. i then copied it to my rails appl in vender/plugin.

So you have now

   vendor/plugins/model_auto_completer

?

i also had gone through the docs, but still couldn't understand how to use it.

Have you read

   http://model-ac.rubyforge.org/classes/ModelAutoCompleterHelper.html

?

-- fxn

Dhaval Phansalkar wrote:

Xavier Noria wrote:

Do you have a svn client installed?

yes, i do have it...

That's suspicious, do you have the command-line client installed and in the PATH?

-- fxn

i didn't get you. but i'm using tortoise and could create an SVN for model_auto_completer.

You'll need a command line client to work with script/plugin:

http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91

There are nice installers that play with Windows.

If the installer doesn't add Subversion to your path, you can add it yourself in the properties of My Computer, under the Advanced tab, clicking on the button labeled Environment Variables, and adding it to the PATH environment variable. After your next login, you can use svn from the command line. :slight_smile:

- -- Phillip Gawlowski Twitter: twitter.com/cynicalryan

Make it clear before you make it faster. ~ - The Elements of Programming Style (Kernighan & Plaugher)

Xavier Noria wrote:

-- fxn

i didn't get you. but i'm using tortoise and could create an SVN for model_auto_completer. now i have model_auto_completer folder with lib,tasks,test etc. i then copied it to my rails appl in vender/ plugin.

So you have now

   vendor/plugins/model_auto_completer

?

i also had gone through the docs, but still couldn't understand how to use it.

Have you read

   http://model-ac.rubyforge.org/classes/ModelAutoCompleterHelper.html

?

-- fxn

@Phillip, Thanks for the info phillip.

@Xavier, yes, but not able to decide which method to use... i tried those methods and that gave me the error as "undefined method `belongs_to_auto_completer'"

-Dhaval

That's a helper and should be used in views.

If that's how you are using it already it may happen that the plugin is not under vendor/plugins, or the server was not restarted....

Unrelated to that error message, but just in case, remember that as in anything related to Ajax you need to include some JavaScript libraries, for example this way:

     <%= javascript_include_tag :defaults %>

-- fxn

Xavier Noria wrote:

yes, but not able to decide which method to use... i tried those
methods and that gave me the error as "undefined method `belongs_to_auto_completer'"

That's a helper and should be used in views.

If that's how you are using it already it may happen that the plugin is not under vendor/plugins, or the server was not restarted....

Unrelated to that error message, but just in case, remember that as in anything related to Ajax you need to include some JavaScript libraries, for example this way:

     <%= javascript_include_tag :defaults %>

-- fxn

i tried all the ways. the folder is in vendor/plugins and server restarted many times. also, have <%= javascript_include_tag :defaults %> in my common template as well as in the page and have latest prototype.js and scriptaculous.js. but the prb still persist. one more thing is, text_field_with_auto_complete works fine but theres a prb that i mentioned in my first post. don't understand what exactly the prb is... :frowning: i'll paste the code tomorrow to get more clear idea, if needed.

-Dhaval

Hey, got this thing worked, my mistake... i was putting the code in wrong place. it should be in customers and not in locations. Thanks for the help, anyways... :slight_smile:

-Dhaval