开发者

How to log searches in rails?

开发者 https://www.devze.com 2023-04-04 07:31 出处:网络
I\'d like to keep a log of all searches that users do on my site which uses the sunspot-rails gem. I don\'t need the logs to be real-time accessible by my application as they\'re for analytics that wi

I'd like to keep a log of all searches that users do on my site which uses the sunspot-rails gem. I don't need the logs to be real-time accessible by my application as they're for analytics that will be processed later.

I'm thinking that I should do th开发者_高级运维e logging in rails rather than in solr itself so that I have access to the entire session, but I'm not sure how to build that. Is there a standard method for this? I saw this question but I would think there would be something more generic than writing it all myself in ApplicationController.


The ultimate answer depends on howwhere you're implementing your search. If you have a single search controller, do the logging there. If you have a collection of search controllers, either do it in each one, or create a base class, do the filter/logging in the base class.

Can you provide any more details?

0

精彩评论

暂无评论...
验证码 换一张
取 消