# Text\_field\_with\_auto\_complete passing parameters

**URL:** <https://www.ruby-forum.com/t/text-field-with-auto-complete-passing-parameters/176013>\
**Category:** Rails\
**Created:** [September 23, 2009, 6:15pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-passing-parameters/176013 "2009-09-23T18:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [September 23, 2009, 6:15pm UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-passing-parameters/176013/1 "2009-09-23T18:15:40Z")

</div>

Hi, I’ve run into a problem with text\_field\_with\_auto\_complete because I  
can’t figure out how to just pass a parameter into the method. For  
example, here’s what i want to try and do:

\<%= text\_field\_with\_auto\_complete :profile, :lastname, :conference\_id =\>  
@conf %\>

And in the method I’m doing this:

def auto\_complete\_for\_profile\_lastname  
@conf = Conference.find(params[conference\_id])

I just can’t seem to get :conference\_id to pass into my method. I’ve  
tried different ways of placing it after the  
text\_field\_with\_auto\_complete, i’ve tried using :with and several other  
things, just can’t seem to get it. Any help would be appreciated, I feel  
like this is a simple problem but I just can’t figure it out 🙂

---

<div class="post-metadata">

**Author:** ![pimeamark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9e8a1a/32.png) [@pimeamark](https://www.ruby-forum.com/u/pimeamark)\
**Post date:** [September 24, 2009, 1:11am UTC](https://www.ruby-forum.com/t/text-field-with-auto-complete-passing-parameters/176013/2 "2009-09-24T01:11:40Z")

</div>

Well I finally figured this out on my own if anyone else reads this. My  
solution was as follows:

\<%= text\_field\_with\_auto\_complete :profile, :lastname, {},  
{:url=\>{:action=\>‘auto\_complete\_for\_profile\_lastname’, :conference\_id =\>  
@conference.id}}%\>

By changing the url, I was able to pass a parameter into it and use  
that. Took a while to find this but it works 🙂
