I''m trying to create a search action for one of my controllers that can take in different params. Something I can use like an api call: ../users/search?first_name=john&org_id=1 Any idea how I can start this? I''d like to have a clean "search" action but this is also copying the index action. I''m thinking that the action needs to serialize the params and apply them to a find but I''m not sure if this is the best way. Thanks. -- 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.
sshefer wrote:> I''m trying to create a search action for one of my controllers that > can take in different params. Something I can use like an api call: > > ../users/search?first_name=john&org_id=1 > > Any idea how I can start this? I''d like to have a clean "search" > action but this is also copying the index action. I''m thinking that > the action needs to serialize the params and apply them to a find but > I''m not sure if this is the best way. > > Thanks.Have you looked at searchlogic? http://github.com/binarylogic/searchlogic Sounds exactly what you are looking for. Cheers Luke -- 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.
Hey Luke, Yeah - I''ve used search logic in the past. I''m trying to make search calls using ajax requests and as I understand it I can''t do that with search logic (I may be wrong). On Sat, Feb 13, 2010 at 5:45 PM, Luke Pearce <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> sshefer wrote: > > I''m trying to create a search action for one of my controllers that > > can take in different params. Something I can use like an api call: > > > > ../users/search?first_name=john&org_id=1 > > > > Any idea how I can start this? I''d like to have a clean "search" > > action but this is also copying the index action. I''m thinking that > > the action needs to serialize the params and apply them to a find but > > I''m not sure if this is the best way. > > > > Thanks. > > Have you looked at searchlogic? > > http://github.com/binarylogic/searchlogic > > Sounds exactly what you are looking for. > > Cheers > Luke > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@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.
Shai Shefer wrote:> Hey Luke, > > Yeah - I''ve used search logic in the past. I''m trying to make search > calls > using ajax requests and as I understand it I can''t do that with search > logic > (I may be wrong).Take what I say with a grain of salt, as I haven''t actually used Searchlogic... but as I understand it it basically just extends ActiveRecord to automagically add a bunch of convenience named scopes, and automatically uses those named scopes when you call search on the the model''s class? It really doesn''t mess with ActionController or ActionView at all besides adding a couple helper methods, so I can''t see how it makes ajax anymore difficult. Have you actually tried using Searchlogic with ajax and encountered problems? If so, what were they? -- 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.
Hi Paul, I think you''re right - I took a second look at searchlogic (I haven''t used it for more than a year) and you can pass your search paramaters in the url pretty cleanly (search?search<http://www.google.com/url?sa=D&q=http://localhost:3000/activities/search%3Fsearch&usg=AFQjCNH06twZNMzjAxjE2ctwuV_8X6BIkQ>[order]=&search[created_by_id_equals]=30&search[hidden]=1). I thought there was some method that would take an encoded url and decode it into the search params but you can just use it directly. My mistake. Searchlogic it is! (Thanks Luke) Thanks, Shai On Sat, Feb 13, 2010 at 9:15 PM, Paul Harrington <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Shai Shefer wrote: > > Hey Luke, > > > > Yeah - I''ve used search logic in the past. I''m trying to make search > > calls > > using ajax requests and as I understand it I can''t do that with search > > logic > > (I may be wrong). > > Take what I say with a grain of salt, as I haven''t actually used > Searchlogic... but as I understand it it basically just extends > ActiveRecord to automagically add a bunch of convenience named scopes, > and automatically uses those named scopes when you call search on the > the model''s class? It really doesn''t mess with ActionController or > ActionView at all besides adding a couple helper methods, so I can''t see > how it makes ajax anymore difficult. Have you actually tried using > Searchlogic with ajax and encountered problems? If so, what were they? > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@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.