On Fri, 2009-07-10 at 22:08 +0200, Shandy Nantz wrote:
> bill walton wrote:
> > Hi Shandy,
> >
> > On Fri, 2009-07-10 at 21:34 +0200, Shandy Nantz 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.
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. ;-)
<%= text_field_with_auto_complete 'user', 'username', :conditions =>
["post = ?", @company_title.id] %>
HTH,
Bill
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---