Auto_complete_for exists but not being found by Rails

Anybody encounter this. I know the method exists in the auto_complete.rb
file in my rails installation, but it itsnt accessing it throught he

Any ideas?

Should I reinstall Rails?

On 7/28/06, Eric G. [email protected] wrote:

Should I reinstall Rails?

Posted via

Rails mailing list
[email protected]

If your using it from the controller then it should be there.

You could always try re-installing rails. It’s a bit hard to guess
happening with as much information as you’ve posted. Can you be a
more specific about what’s happening

Sure Daniel,

This is the controller code:

def realsignup
auto_complete_for :sports, :name

realsignup.rhtml is the page that gets loaded.

Here is the error I get.

“undefined method `auto_complete_for’ for #UserController:0x37d88a8


Daniel ----- wrote:

On 7/28/06, Eric G. [email protected] wrote:

Should I reinstall Rails?

Posted via

Rails mailing list
[email protected]

I have used the auto complete and its working for me…

The way I did it was

In the views

   1.  Include the default javascript in the .rhtml file
  		<%= javascript_include_tag  :defaults %>

   2.  Where ever u wanna do the autocomplete include this tag

        <%= text_field_with_auto_complete :movie, :movie_name %>

        book and the book_name are the name of the textbox
        So u can access the value of the textbox with
        params[:movie]['movie_name'] in the controller.

       Thats all in the views...

Now in the controller

  1.   Define a method named "auto_complete_for_book_book_name"
       Remember this method should be there in the same controller 

as that of the view page.
I tried the way u did b4, and got the same error. So I did
this way…

       	def auto_complete_for_book_book_name
		book_search = params[:movie][:movie_name]
		@books = Book.find(:all,
				   :conditions => [ 'LOWER(book_name) LIKE ?',book_search.downcase 
  • ‘%’ ],
    :order => ‘book_name ASC’)
    render :partial => ‘/views/all_views’

     2. Write a partial rhtml page named all_views

Thats it…

An example is given in the Follow this link and find

Hey Anand,

Thanks for the advice, I got it to work kinda.

Its querying my database, however when I click on one of the items, its
shows up in the text field with a top margin and extra spaces on both
sides of the entry.

Basically, when it shows up in my text field, i can only see the very
top of the word because the whole entry is shifted down some. I have to
drag within the text field to reveal the word.

Overall, it takes up like 3 lines with the word in the middle line, so
you cant even see the word unless you drag down inside the text field.
Do you know what could be wrong?

I am a bit confused what ur problem is???
if u dont have any probs, can u just take a screenshot of it and send me
so that I can understand it properly…

my mai id is [email protected]


Ananda, I got it working, basically, in the partial for the list, there
were spaces

in between the div and li tags…

thanks for all your help…

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