# Problem with autocomplete

**URL:** <https://www.ruby-forum.com/t/problem-with-autocomplete/180507>\
**Category:** Rails\
**Created:** [December 20, 2009, 8:32pm UTC](https://www.ruby-forum.com/t/problem-with-autocomplete/180507 "2009-12-20T20:32:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![longhorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c5a1d2/32.png) [@longhorn](https://www.ruby-forum.com/u/longhorn)\
**Post date:** [December 20, 2009, 8:32pm UTC](https://www.ruby-forum.com/t/problem-with-autocomplete/180507/1 "2009-12-20T20:32:57Z")

</div>

The another problem i solved, because just have to render the view

new  
\<%= text\_field\_with\_auto\_complete :alergias\_paciente, :alergia\_nombre,  
{ :size =30 },  
{ :url =alergia\_path(:js), :method =:get, :param\_name =  
‘search’} %\>

alergia controller  
def index  
@alergias = Alergia.find(:all, :conditions =[‘nombre LIKE ?’,  
“%#{params[:search]}%”])  
end

alergias\_paciente model

def alergia\_nombre  
return alergia.nombre if alergia  
end map.resources :alergias\_pacientes  
def alergia\_nombre=(nombre)  
self.alergia = Alergia.find\_by\_nombre(nombre) unless nombre.blank?  
end

def index  
@alergias = Alergia.find(:all, :conditions =[‘nombre LIKE ?’,  
“%#{params[:search]}%”])  
end

routes rb map.resources :alergias\_pacientes

application.html.erb

\<%= javascript\_include\_tag :defaults %\>

js shows me alergias but it does not autocomplete the form the  
I remove formated because it tell me, was deprecated. in the other  
without the  
formated continues ok. as if it sought to apply the js or maybe is wrog  
the way i map or something like that  
what do you say?
