[Rails] Re: Autocomplete plugin
If I understand well the question the answer should be yes. If what you mean is if it is possible to use one field on a page to find data in more than one column in the table it should be possible the only thing you would need is to query the table by the columns you desire to query on. On May 10, 7:23 pm, Mlle emsto...@gmail.com wrote: Hi Is it possible to use the autocomplete plugin to search using a keyword on more than one field of a model? How can I do that? -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Autocomplete plugin
Thanks for your comments. I understand what you're saying but I guess my question had more to do with the population of the actual list, not the database query. If you use the autocomplete plugin, the list that populates under the input box has to be a certain field of a certain model. For example, when you call this helper: model_auto_completer_result(@inventories, :inventory_id ) the inventory_id is displayed for each inventory item matching the query. I'd like to search on two fields in the inventories table and display whichever field matched in the autocomplete list. On May 11, 10:05 am, Walter Davis wa...@wdstudio.com wrote: On May 10, 2011, at 7:23 PM, Mlle wrote: Hi Is it possible to use the autocomplete plugin to search using a keyword on more than one field of a model? How can I do that? When you use autocompletion, you define a field to watch, and an endpoint to query against. Whatever query conditions you put in the method that answers that endpoint will be the results that appear in the autocompleter's list. So if you had generated: new Ajax.Autocompleter('person','/people/lookup',{}); Then in Person#lookup you would be looking for Person.all(:conditions = ['first_name LIKE ? OR last_name LIKE ?'],#{params[:value]}%,#{params[:value]}%]) Crude example, but you get the idea... Walter -- 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- t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com . For more options, visit this group athttp://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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Autocomplete plugin
On May 11, 2011, at 11:27 AM, Mlle wrote: Thanks for your comments. I understand what you're saying but I guess my question had more to do with the population of the actual list, not the database query. If you use the autocomplete plugin, the list that populates under the input box has to be a certain field of a certain model. For example, when you call this helper: model_auto_completer_result(@inventories, :inventory_id ) the inventory_id is displayed for each inventory item matching the query. I'd like to search on two fields in the inventories table and display whichever field matched in the autocomplete list. Back up to the line where you define @inventories. That's where you would make the filter broad enough to include hits on more than one field. Walter On May 11, 10:05 am, Walter Davis wa...@wdstudio.com wrote: On May 10, 2011, at 7:23 PM, Mlle wrote: Hi Is it possible to use the autocomplete plugin to search using a keyword on more than one field of a model? How can I do that? When you use autocompletion, you define a field to watch, and an endpoint to query against. Whatever query conditions you put in the method that answers that endpoint will be the results that appear in the autocompleter's list. So if you had generated: new Ajax.Autocompleter('person','/people/lookup',{}); Then in Person#lookup you would be looking for Person.all(:conditions = ['first_name LIKE ? OR last_name LIKE ?'],#{params[:value]}%,#{params[:value]}%]) Crude example, but you get the idea... Walter -- 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- t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com . For more options, visit this group athttp://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- t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com . 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Autocomplete Plugin - how can I use same text_field_with_auto_complete twice on one page?
I ran into the same problem a while back and forked the plugin to fix it; see: http://patshaughnessy.net/repeated_auto_complete Hope this helps, - pat On Jun 2, 1:51 pm, Andy andym...@gmail.com wrote: Any ideas here? On May 28, 1:49 pm, Andy andym...@gmail.com wrote: I'm trying to use an autocomplete twice on the same page, but only the first one renders and functions. I'm using the Autocomplete Plugin and Rails 2.1 Thanks, Andy --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Autocomplete Plugin - how can I use same text_field_with_auto_complete twice on one page?
Any ideas here? On May 28, 1:49 pm, Andy andym...@gmail.com wrote: I'm trying to use an autocomplete twice on the same page, but only the first one renders and functions. I'm using the Autocomplete Plugin and Rails 2.1 Thanks, Andy --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Autocomplete plugin with Rails 2.0
Tanks Elad Roz Attachment: auto_complete_macros_helper.rb (7,6 KB) your attachment it s work perfectly -- 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Autocomplete plugin with Rails 2.0
Eric Pugh wrote: I tried out adding the exclude line: protect_from_forgery :only = [:tag] However, it seems ugly that I have to add each method manually. I tried protect_from_forgery :exclude = [:auto_complete_for_tag_name] but that didn't work. Is this oddness a) a bug or b) just something the docs for the plugin should discuss? use :except instead of :exclude = protect_from_forgery :except = [:auto_complete_for_tag_name] -- 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Autocomplete plugin with Rails 2.0
use :except instead of :exclude = protect_from_forgery :except = [:auto_complete_for_tag_name] http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html#M000493 -- 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---