Skip to content

Commit

Permalink
basic use
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasc committed Aug 13, 2014
1 parent cd58f79 commit 60f3e16
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ Or install it yourself as:

$ gem install mongoid_traffic

## Basic Usage

Log your traffic like this:

Mongoid::TrafficLogger.log('/pages/123', user_agent: user_agent_string, referer: referer_string)

Or, in case of Rails, use the `after_action` macro in your controller:

class MyController < ApplicationController
after_action :log_traffic, only: [:show]
end

## Classes

This gem consists of two basic classes: `MongoidTraffic::Logger` and `MongoidTraffic::Log`. The `Logger` takes care of upserting data in to the db using atomic updates, while the `Log` class is a `Mongoid::Document` class that wraps the records into neat models with scopes and helper methods for querying the log.
Expand Down

0 comments on commit 60f3e16

Please sign in to comment.