Hi All, I am implementing a search for my blog. I have it as you can type in tags and words, and I keep them as session variables. I was just thinking if this was a good idea ? I saw on learning ruby on rails, that Ryan put such a search in a model and kept it in a database. My site is hardly anything like twitter. So I would really like to hear what you have to say about this. Trausti --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This may depend on what you want to do with those keywords: 1) Nothing: When why keep them at all? Run the search and forget them Or redisplay in the searchbox for next search, for that you can still get them from the params at this stage. 2) Keep the actual search for redisplay next time the user comes back You could keep them in the session, but would lose them if the user logs out. 3) Run statistics what users are searching Then you must keep them in the database So I think there is not that much use in keeping them in the session. Keeping them in the database makes sense if you store every single search.
My idea is that as soon as the user leaves the website it should go away. No need to keep the query around. This just ends up in an array and will be run with :conditions on the query. Trausti On Wed, Aug 12, 2009 at 3:07 PM, Thorsten Müller < thorsten.muller.amsterdam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > This may depend on what you want to do with those keywords: > > 1) Nothing: > When why keep them at all? Run the search and forget them > Or redisplay in the searchbox for next search, for that you can > still get them from the params at this stage. > > 2) Keep the actual search for redisplay next time the user comes back > You could keep them in the session, but would lose them if the user > logs out. > > 3) Run statistics what users are searching > Then you must keep them in the database > > > So I think there is not that much use in keeping them in the session. > Keeping them in the database makes sense if you store every single > search. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---