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

On Apr 14, 2008, at 14:35 , Dhaval P. wrote:

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…

Have a look at model_auto_completer:

http://agilewebdevelopment.com/plugins/model_auto_completer

– fxn

Xavier N. wrote:

On Apr 14, 2008, at 14:35 , Dhaval P. wrote:

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…

Have a look at model_auto_completer:

http://agilewebdevelopment.com/plugins/model_auto_completer

– fxn

hi xavier,
i’d tried that,it doesn’t get installed. when i run this command “ruby
script/plugin install
svn://rubyforge.org/var/svn/model-ac/trunk/vendor/plugins/model_auto_completer”
, nothing happens.

-dhaval

On Apr 14, 2008, at 14:50 , Dhaval P. wrote:

hi xavier,
i’d tried that,it doesn’t get installed. when i run this command “ruby
script/plugin install
svn://rubyforge.org/var/svn/model-ac/trunk/vendor/plugins/
model_auto_completer”
, nothing happens.

Do you have a svn client installed?

Xavier N. wrote:

On Apr 14, 2008, at 14:35 , Dhaval P. wrote:

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…

Have a look at model_auto_completer:

http://agilewebdevelopment.com/plugins/model_auto_completer

– fxn

hi Xavier,
i’d tried that,it doesn’t get installed. when i run this command “ruby
script/plugin install
svn://rubyforge.org/var/svn/model-ac/trunk/vendor/plugins/model_auto_completer”
, nothing happens.

-dhaval

Xavier N. wrote:

On Apr 14, 2008, at 14:50 , Dhaval P. wrote:

hi xavier,
i’d tried that,it doesn’t get installed. when i run this command “ruby
script/plugin install
svn://rubyforge.org/var/svn/model-ac/trunk/vendor/plugins/
model_auto_completer”
, nothing happens.

Do you have a svn client installed?

yes, i do have it…

On Apr 14, 2008, at 18:20 , Dhaval P. 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

Xavier N. wrote:

On Apr 14, 2008, at 18:20 , Dhaval P. 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.
i also had gone through the docs, but still couldn’t understand how to
use it.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dhaval P. wrote:
| Xavier N. wrote:
|> On Apr 14, 2008, at 18:20 , Dhaval P. 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 G.
Twitter: twitter.com/cynicalryan

Make it clear before you make it faster.
~ - The Elements of Programming Style (Kernighan & Plaugher)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgEcLwACgkQbtAgaoJTgL9DvwCgjjWKC1SNhhEOuMDBV7Dfy/o6
KYQAn3LzVvsuOJNLhux/lppKX+PkQ46C
=x6o8
-----END PGP SIGNATURE-----

On Apr 15, 2008, at 10:40 , Dhaval P. 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

Xavier N. wrote:

On Apr 15, 2008, at 10:40 , Dhaval P. 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

Xavier N. wrote:

On Apr 15, 2008, at 14:41 , Dhaval P. 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

On Apr 15, 2008, at 14:41 , Dhaval P. 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 found a tutorial here that works properly here
http://share-facts.blogspot.com/2009/02/autocompleter-example-in-ruby-on-rails.html

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs