but because it is in a partial that pops as a result from a
remote_function_tag, I am having trouble seeing the html to know if this
is even working. In any event, it is not giving me back what I want.
Is there a way to pass parameters to the auto_complete_for method?
On Fri, 2009-07-10 at 21:34 +0200, Shandy N. wrote:
I need to pass a parameter in my text_field_with_auto_complete
What’s the parameter supposed to do? What are you trying to accomplish?
Bill
Well, I have an auto_complete to get users names, and in other forms it
works great. This auto_complete, however, it first asks the user to
select an account and then pull all the users from that account, so the
parameter that I need to pass is the id to the account to populate that
list.
On Fri, 2009-07-10 at 22:08 +0200, Shandy N. wrote:
Well, I have an auto_complete to get users names, and in other forms it
works great. This auto_complete, however, it first asks the user to
select an account and then pull all the users from that account, so the
parameter that I need to pass is the id to the account to populate that
list.
Ah. Ok. It’s been a while since I used auto_complete and haven’t
tested this, but it should point you in the right general direction.
First though, note that everything after the first two parameters is
interpreted as elements of a hash. You don’t need the {} notation. The
items that can appear in that hash are the parameters to
ActiveRecord::Base#find. IIRC auto_complete just passes them through to
the find. You’re wanting to supply the :conditions. The syntax may be
wrong but I already warned you I haven’t tested it.