Posted By

nmontoza on 12/19/08


Tagged

rails ruby


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

nmontoza
sergeizen
webstic
davidsi


auto_complete


 / Published in: Rails
 

URL: http://github.com/rails/auto_complete/tree/master

  1. ##controller
  2.  
  3. #en algunos casos requiere un skip_before_filter para corregir un error de verify_authenticity
  4. skip_before_filter :verify_authenticity_token, :only => :auto_complete_for_user_apellido
  5.  
  6.  
  7. #auto_complete_for :modelo, :campo
  8.  
  9. auto_complete_for :user, :apellido
  10.  
  11. ## config/routes.rb
  12. map.resources :admin, :collection => {:auto_complete_for_user_apellido => :get}
  13.  
  14. ##view
  15. <%= text_field_with_auto_complete :paciente, :nombre, {}, {:method => :get, :skip_style => true}%>
  16.  
  17. #tambien se puede pasar un javascript
  18. <%= text_field_with_auto_complete :user, :apellido, {},:after_update_element => 'function(text, li){ alert(mensaje);}'%>

Report this snippet  

You need to login to post a comment.