Text_field_with_auto_complete passing parameters

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 :slight_smile:

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 :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs