0.0
No commit activity in last 3 years
No release in over 3 years
ViewsCount is a lightweight plugin to keep track of views of an ActiveRecord model.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
 Project Readme

ViewsCount

Installation

Add this line to your application's Gemfile:

gem 'views_count'

And then execute:

$ bundle

Or install it yourself as:

$ gem install views_count

Generate the config file and table migration

$ rails g views_count

This allows you to attach views count method to an AR model instance. By default, it requires a column views_count to keep track of the view hits. You can specify column_name to whatever fits your situation.

class Topic < ActiveRecord::Base
  has_views_count
end

class Topic < ActiveRecord::Base
  has_views_count column_name: 'views_count'
end    

Contributing

  1. Fork it ( https://github.com/[my-github-username]/views_count/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request