I changed the url in the macros helper file:

:url => { :action => "auto_complete_for", :id=>"#{object}_#{method}" }


  def text_field_with_auto_complete(object, method, tag_options = {},
completion_options = {})
    (completion_options[:skip_style] ? "" : auto_complete_stylesheet)
+
    text_field(object, method, tag_options) +
    content_tag("div", "", :id => "#{object}_#{method}
_auto_complete", :class => "auto_complete") +
    auto_complete_field("#{object}_#{method}", { :url => { :action =>
"auto_complete_for", :id=>"#{object}
_#{method}" } }.update(completion_options))
  end


Now I can write a method that applies to all auto complete fields.


On Jul 12, 5:49 pm, Mlle <[email protected]> wrote:
> I saw an example of the auto complete field sending a ajax request in
> this format that allows a method in the controller to catch all auto
> complete ajax requests:
>
> '/rails/app/auto_complete_for/sample_origin'
>
> but when I use it, the request is
>
> '/rails/app/auto_complete_for_sample_origin'
>
> My template says this
>
>  <%=text_field_with_auto_complete :sample, c,   {:skip_style=>true}%>
>
> How can I change it so that the request is '/rails/app/
> auto_complete_for/sample_origin' ?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to