# Problem with text\_field\_with\_auto\_complete

**URL:** <https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081>\
**Category:** Rails\
**Created:** [April 7, 2008, 5:53pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081 "2008-04-07T17:53:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [April 7, 2008, 5:53pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081/1 "2008-04-07T17:53:22Z")

</div>

I Just looked into how to use text\_field\_with\_auto\_complete, but for  
some reason it wont work on my page. It gives me this error as an  
undefined method.

undefined method `text\_field\_with\_auto\_complete’ for  
#ActionView::Base:0x250f42c

I have javascript\_include\_tag :defaults in my layout, I have the latest  
version of scriptaculous, i even did script/plugin install auto\_complete  
in my terminal. I tried using another scriptaculous method and it worked  
just fine. Anyone have an idea as to why this one wont work?

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [April 7, 2008, 11:11pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081/2 "2008-04-07T23:11:11Z")

</div>

> undefined method `text\_field\_with\_auto\_complete’ for  
> #ActionView::Base:0x250f42c

The problem is not in your javascript. The problem is the View doesn’t  
know that method. Check the auto\_complete example again your probably  
missing a line like:

auto\_complete\_for :post, :title

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [April 8, 2008, 12:01pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081/3 "2008-04-08T12:01:46Z")

</div>

On Apr 7, 2008, at 17:53 , Mark Mr wrote:

> auto\_complete  
> in my terminal. I tried using another scriptaculous method and it  
> worked  
> just fine. Anyone have an idea as to why this one wont work?

It should work. Did you restart the server?

– fxn

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [April 8, 2008, 4:11pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081/4 "2008-04-08T16:11:05Z")

</div>

Found this:

[http://trix.pl/blog/ruby-on-rails/auto-complete-for-rails-2-0-tutorial](http://trix.pl/blog/ruby-on-rails/auto-complete-for-rails-2-0-tutorial)

Hope it helps, haven’t tried it, but looks fairly simple… also take  
a look at the comments.

Cheers.

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [April 9, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081/5 "2008-04-09T15:36:53Z")

</div>

It is fairly simple to use. The problem, most likely, is that  
autocomplete was pulled out of the core and placed in a plugin.  
autocomplete does not autocomplete itself. 🙂

On Apr 8, 10:10 am, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [April 9, 2008, 10:21pm UTC](https://www.ruby-forum.com/t/problem-with-text-field-with-auto-complete/134081/6 "2008-04-09T22:21:22Z")

</div>

Yeah apparently i forgot to restart the server and thats why. I then had  
another problem with permission which i solved by using

protect\_from\_forgery :only =\> [:create, :update, :destroy]

Now it seems to be working ok 🙂
