Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Adds functionality to the models that are viewable
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.document
.gitignore
.rspec
.rvmrc
Gemfile
MIT-LICENSE
README.markdown
Rakefile
VERSION
acts_as_viewable.gemspec

README.markdown

ActsAsViewable

General information

Adds functionality to models.

Installation

To use it, add it to your Gemfile:

gem 'acts_as_viewable', :git => 'git@github.com:ivoreis/acts_as_viewable.git' or
gem 'acts_as_viewable', :github => 'ivoreis/acts_as_viewable'
bundle update / bundle install

Post Installation

  1. rails g acts_as_viewable:install
  2. rake db:migrate

Configuration

Nothing to do

Testing

ActsAsViewable uses RSpec for its test coverage

rake spec

Usage

class Viewable < ActiveRecord::Base
  acts_as_viewable
end

class Viewer < ActiveRecord::Base
  acts_as_viewer
end

After is possible to use this way:

#Create a new visualization by the @viewer
@viewable.viewed_by(@viewer)
#Count the visualizations of this @viewable
@viewable.count_views
#Retrieve the visualizations that the @viewer made to this @viewable item
@viewer.views_of(@viewable)

Credits

License

Copyright (c) 2012 Ivo Reis, released under the MIT license

Something went wrong with that request. Please try again.