I have a method in my controller that would apply to all fields that
use the auto_complete plugin
def auto_complete_for
object = params[:id].split('_')[0]
method = params[:id].split('_')[1]
table = object.to_s.camelize.constantize.table_name
object.to_s.camelize.constantize::init( @lang )
tables = object.to_s.camelize.constantize::tables
if tables.include?( "#{table}_#{method}" )
etc…
So in my template I have:
<%=text_field_with_auto_complete :sample, c, {:skip_style=>true} %>
but the ajax request is not right. It says
http://localhost:3000/echantillons/auto_complete_for_sample_technique
and the parameters are
Parameters: {“sample”=>{“technique”=>“test”}}
whereas I think it should say
http://localhost:3000/echantillons/auto_complete_for/sample_technique
with parameters {“id”=>{“sample_technique”"}}
What am I doing wrong?