Auto_Complete plugin with results from two tables

The trouble free method would be to create a "view table" using both
tables and use it to do auto complete.

Yep, I want to search for course and tutor name in the same input box,
but I'm not using Shaughnessy's plugin, I'm using the standard
auto_complete plugin.

I've tried commenting the line

#auto_complete_for :tutor, :name

supposing I'm implementing my own method, with no success

I guess the problem might be at:

render :inline => "<%= auto_complete_result(@tutors+@courses, :name) %>"

Becaus the find's are working properly.

What can it be ?

I guess the problem might be at:

render :inline => "<%= auto_complete_result(@tutors+@courses, :name) %>"

Becaus the find's are working properly.

Have you try to merge then before sending?

@tutors+=@courses
render :inline => "<%= auto_complete_result(@tutors, :name) %>"

Does tutors and courses have the field name?

Just guessing here, I don't know what it can be.

David Sousa

Thanks for your help David.

I have also tried writing my custom method just with tutors, but it
doesn't works either!!! I guess the problem is related with something
else :frowning:

def auto_complete_for_tutor_name
   @tutors = Tutor.find(:all, :conditions => ["enabled = 't' AND LOWER(name) LIKE ?", "%#{params[:tutor][:name]}%"], :limit => 10)
   render :inline => "<%= auto_complete_result(@tutors, :name) %>"
end

:S No clue what can it be :frowning:

I found this code inside
vendor/plugins/auto_complete/lib/auto_complete.rb . Could this be used ?

Lol, I saw that was protected but I did not realize that.

The problem was stupid. The method was 'protected'

David Sousa