# Auto\_complete plugin in Rails 2.2.2 (auto\_complete\_for method not found)

**URL:** <https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246>\
**Category:** Rails\
**Created:** [February 13, 2009, 11:29am UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246 "2009-02-13T11:29:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 13, 2009, 11:29am UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/1 "2009-02-13T11:29:20Z")

</div>

Hello world,  
I am considering myself to be a newbie in Ruby, but not programming in  
general and i have a very serious problem trying to get Rails 2.2.2 to  
install the auto\_complete plugin in Windows XP. I always get the  
“auto\_complete\_for method not found” error in ruby.

After 2 days of full-internet-search I have tried the following:

- Using the “ruby script/plugin install auto\_complete” command :  
results in “not found” (even after adding every single repository  
under discovery)

- Trying to load the SVN URL posted in oh-so-many forums, in the “ruby  
on rails” official site, I get a “page not found” error

- Trying to manually copy the files in the vendor/plugin directory of  
my project (got them from the model\_auto\_completer example), but still  
does not work… (if i execute “script/plugin list” there is nothing)

Regarding this last part, i have been trying to find documentation  
about how to manually install a plugin, but with no results. In every  
forum that someone asks “how to do it manually” people respond with  
“script/plugin install”. This is automatic, not manually, as i am sure  
most of you know. What i am searching for is instructions on: where to  
place the files myself and what to execute myself so that my project  
will ‘use’ the plugin.

I will be thankful for any help you might offer, no matter how small,  
but PLEASE don’t repeat to me steps i have already taken with no  
differentation what-so-ever. This is both pointless and insulting.

Yours sincerely,  
a frustrated RoR programmer  
Spiros K.

---

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 13, 2009, 11:56am UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/2 "2009-02-13T11:56:22Z")

</div>

On 13 Feb 2009, at 09:19, Spiros K. wrote:

> most of you know. What i am searching for is instructions on: where to  
> place the files myself and what to execute myself so that my project  
> will ‘use’ the plugin.

Copying the files into vendor/plugins is all there is to it 99% of the  
time. Some plugins have an install.rb file that needs to be run after  
this.  
Don’t worry about the output of script/plugin list (which as far as I  
can tell is for listing available, not installed plugins)

The autocomplete plugin is on github these days:

> **[GitHub - rails/auto\_complete: NOTICE: official repository moved to...](https://github.com/rails/auto_complete/tree/master)**
>
> master

Newer versions of rails include a version of script/plugin that can  
install plugins from git repositories (assuming you have git itself of  
course).

Fred

---

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 14, 2009, 11:00am UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/3 "2009-02-14T11:00:03Z")

</div>

Thanks for your reply,  
but

1. this specific plugin did not have an install.rb with it.
2. 2.2.2 is as new as they get I just downloaded 3 weels ago…?! And  
i think it works just fine with git as I have downloaded from git as  
well (though it messed my tortoise svn structure pretty badly)

Then fired up my script/server and still:

“method not found” for autocomplete\_for method!!! ☹

On Feb 13, 12:55 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 14, 2009, 4:53pm UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/4 "2009-02-14T16:53:30Z")

</div>

Yes, the plugin IS in vendor plugins and YES you can check my first  
post in the thread and see that my 2nd post was actually a typo in my  
behalf. The problem remains as stated.

BTW, the code was copy-pasted from tutorials that supposedly work, so  
I doubt there is any weird typo in the actual code.

On Feb 14, 12:41 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 14, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/5 "2009-02-14T17:56:14Z")

</div>

On Feb 14, 3:52 pm, “Spiros K.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Yes, the plugin IS in vendor plugins and YES you can check my first  
> post in the thread and see that my 2nd post was actually a typo in my  
> behalf. The problem remains as stated.

odd. i’d stick a breakpoint in the plugin’s init.rb to see what was  
happening there (you should have vendor/plugins/auto\_complete/init.rb  
and vendor/plugins/auto\_complete/lib ) If you have changed  
config.plugins or config.plugin\_paths in environment.rb that could  
cause this (but I rather suspect you’d remember if you’d done that).

> BTW, the code was copy-pasted from tutorials that supposedly work, so  
> I doubt there is any weird typo in the actual code.

I wouldn’t be so sure 🙂

Fred

---

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 14, 2009, 11:42am UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/6 "2009-02-14T11:42:13Z")

</div>

On Feb 14, 9:58 am, “Spiros K.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks for your reply,  
> but
> 
> 1. this specific plugin did not have an install.rb with it.
> 2. 2.2.2 is as new as they get I just downloaded 3 weels ago…?! And  
> i think it works just fine with git as I have downloaded from git as  
> well (though it messed my tortoise svn structure pretty badly)

so is the plugin in vendor/plugins ?

> Then fired up my script/server and still:
> 
> “method not found” for autocomplete\_for method!!! ☹

I also assume that that was a typo and you actually write  
auto\_complete\_for in your controller.

Fred

---

<div class="post-metadata">

**Author:** ![Spiros\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9a140/32.png) [@Spiros\_K](https://www.ruby-forum.com/u/Spiros_K)\
**Post date:** [February 17, 2009, 10:14am UTC](https://www.ruby-forum.com/t/auto-complete-plugin-in-rails-2-2-2-auto-complete-for-method-not-found/160246/7 "2009-02-17T10:14:02Z")

</div>

I checked today and everything is in order (that is commented out as  
is the default).  
Do you mean i should have added 1 or more lines to the  
“environment.rb” file??

Anyway, so for the sake of completeness, here is my code!

#models#  
#----------#

#book model  
has\_many :book\_authorities, :dependent =\> :delete\_all  
has\_many :authorities, :through =\> :book\_authorities

#authority\_model  
has\_many :book\_authorities, :dependent =\> :delete\_all  
has\_many :books, :through =\> :book\_authorities

#book\_authority model  
belongs\_to :book  
belongs\_to :authority  
auto\_complete\_for :authority, :surname

#view#  
#------#

 \<% fields\_for "book[book\_authority\_attributes][]", book\_authority, :index =\> nil do |bookauthority\_form| %\> authority: \<%= bookauthority\_form.select(:authority\_id, $allnames) %\>   
 capacity: \<%= bookauthority\_form.text\_field :capacity, :index =\> nil %\>   
 \<% if book\_authority.new\_record? %\> \<%= link\_to\_function "remove", "$(this).up ('.book\_authority').remove()" %\> \<% else %\> \<%= link\_to\_function "remove", "mark\_for\_destroy\_ba(this)" %\> \<%= bookauthority\_form.hidden\_field :id %\> \<%= bookauthority\_form.hidden\_field :should\_destroy, :index =\> nil, :class =\> 'should\_destroy' %\> \<% end %\> \<% end %\>

#controllers#  
#---------------#

#application\_controller

def update\_authorities  
#@allauthorities = Authority.find(:all, :limit =\> 5000, :order =\>  
“id ASC”)  
@allauthorities = Authority.find(:all)  
$allnames = Hash.new()  
for a in @allauthorities  
$allnames.merge!({ ((a.surname || “”) + " " + (a.name || “”) +  
“,” + (a.short\_title || “”)) =\> a.id})  
end  
end

On Feb 14, 6:55 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
