Hi, I am trying to make the search_field look into a table of my database which is different from the form''s object''s table. Basically, I want to do this: <td><%= f.search_field(:sport, Sport.all.collect {|s|[s.sport_name]}) %></td> But it does not work obviously. Sorry if this issue has already been raised but I did not find any solution after searching on google and in this group posts. Thank you in advance for your help, Alex -- 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.
What exactly are you trying to do? All that search_field does is create a HTML input with type="search" If you want a dropdown you should use collection_select or something similar -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/5Kke2y_WvhMJ. 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.
Hi, Thank you for your reply. I solved my problem using Custom Form Builder. I created a custom form field for the new HTML5 datalist. If anyone is interested, I can post my solution which is definitely not optimal since I am new to rails. regards, Alexandre On 30 January 2012 17:30, Tim Shaffer <timshaffer-BUHhN+a2lJ4@public.gmane.org> wrote:> What exactly are you trying to do? All that search_field does is create a > HTML input with type="search" > > If you want a dropdown you should use collection_select or something > similar > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/5Kke2y_WvhMJ. > > 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. >-- 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.
On Mon, Jan 30, 2012 at 11:40 AM, Alexandre Balon-Perin <abalonpe-gFQn2mEGIOGzQB+pC5nmwQ@public.gmane.org>wrote:> Hi, > > Thank you for your reply. > I solved my problem using Custom Form Builder. I created a custom form > field for the new HTML5 datalist. If anyone is interested, I can post my > solution which is definitely not optimal since I am new to rails. > > regards, > Alexandre > >I''m also doing some searchs using fields, I used the autocomplete method of jquery (I saw that in a railscast) -- 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.
@Javier: I also watched the railscast but I prefer a "Ruby solution". The custom form builder is simple and very readable so I am gonna stick with it. :) Anyway thank you for your reply, I appreciate it. Alex On 30 January 2012 17:59, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Mon, Jan 30, 2012 at 11:40 AM, Alexandre Balon-Perin < > abalonpe-gFQn2mEGIOGzQB+pC5nmwQ@public.gmane.org> wrote: > >> Hi, >> >> Thank you for your reply. >> I solved my problem using Custom Form Builder. I created a custom form >> field for the new HTML5 datalist. If anyone is interested, I can post my >> solution which is definitely not optimal since I am new to rails. >> >> regards, >> Alexandre >> >> > I''m also doing some searchs using fields, I used the autocomplete method > of jquery (I saw that in a railscast) > > > -- > 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. >-- 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.