use jquery autocomplete. http://docs.jquery.com/Plugins/autocomplete
<http://docs.jquery.com/Plugins/autocomplete>sidenote: don''t use
joins as an
association name because it''s an argument for the find method.
On Mon, Feb 14, 2011 at 12:38 AM, Patrice Cartier
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:
> hi,
>
>
> i have 2 models and 1 join_table:
>
> film.rb
>
> has_many :joins, :dependent => :destroy
> has_many :people, :through => :joins
>
> person.rb
>
> has_many :joins, :dependent => :destroy
> has_many :films, :through => :joins
>
> join.rb
>
> belongs_to: film
> belongs_to: person
>
> in views/films/ _form.rhtml
>
> <%- f.fields_for :joins do |builder| %>
> <%= render "films/join_fields", :f => builder %>
> <%- end %>
>
>
> in the partial join_fields.rhtml :
>
> <p class="fields">
>
> <%= f.select :person_id, options_for_select(Person.all(:order=>
''name
> asc'').map {|p| [p.name, p.id]}, f.object.person_id)%>
>
> <%= f.hidden_field :_destroy %>
> <%= link_to_function "delete",
"remove_fields(this)" %>
>
> </p>
>
>
> I would like to change f.select ( because there is a lot of records ) by
> auto-completion
>
> any idea ?
>
>
> thanks!
>
> Patrice
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.