Eric Gross
2006-Jul-28 02:17 UTC
[Rails] 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 program. Any ideas? -- Posted via http://www.ruby-forum.com/.
Eric Gross
2006-Jul-28 04:11 UTC
[Rails] Re: auto_complete_for exists but not being found by Rails
Should I reinstall Rails? -- Posted via http://www.ruby-forum.com/.
Daniel N
2006-Jul-28 04:19 UTC
[Rails] Re: auto_complete_for exists but not being found by Rails
On 7/28/06, Eric Gross <tennisbum2002@hotmail.com> wrote:> > Should I reinstall Rails? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >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 whats happening with as much information as you''ve posted. Can you be a little more specific about what''s happening -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060728/fb371a69/attachment.html
Eric Gross
2006-Jul-28 04:45 UTC
[Rails] Re: Re: auto_complete_for exists but not being found by Rail
Sure Daniel,
This is the controller code:
def realsignup
auto_complete_for :sports, :name
end
realsignup.rhtml is the page that gets loaded.
Here is the error I get.
"undefined method `auto_complete_for'' for
#<UserController:0x37d88a8>"
Eric
Daniel ----- wrote:> On 7/28/06, Eric Gross <tennisbum2002@hotmail.com> wrote:
>>
>> Should I reinstall Rails?
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> Rails mailing list
>> Rails@lists.rubyonrails.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
--
Posted via http://www.ruby-forum.com/.
Anand Srinu
2006-Jul-28 06:19 UTC
[Rails] Re: Re: auto_complete_for exists but not being found by Rail
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''
end
2. Write a partial rhtml page named all_views
Thats it......
An example is given in the script.aculo.us. Follow this link and find
it...
http://demo.script.aculo.us/ajax/autocompleter_customized
--
Posted via http://www.ruby-forum.com/.
Eric Gross
2006-Jul-28 07:52 UTC
[Rails] Re: Re: auto_complete_for exists but not being found by Rail
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? -- Posted via http://www.ruby-forum.com/.
Anand
2006-Jul-28 10:38 UTC
[Rails] Re: Re: auto_complete_for exists but not being found by Rail
Hi,
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 mail2sanand@gmail.com
Regards,
Anand
--
Posted via http://www.ruby-forum.com/.