GithubHelp home page GithubHelp logo

joshnabbott / acts_as_loggable Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 80 KB

Allows you to have an audit trail of crud actions performed on ActiveRecord models.

Home Page: http://iammrjoshua.com

License: MIT License

Ruby 100.00%

acts_as_loggable's Introduction

ActsAsLoggable
==============

How many times have you been informed by a customer or visitor to your site of a horrible type right on your front page and thought "Huh. That's weird, I don't usually make mistakes like that. I wonder who messed that up?"

Well, ActsAsLoggable is a simple plugin that gives you the power to know who it was and when they did it. It's as simple as adding acts_as_loggable to the model you want to "Big Brotherize" and then sit back and enjoy the peace of mind knowing that whatever records are getting added, edited, or destroyed you'll know who did it.

ActsAsLoggable also supports standard :except and :only conditions (acts_as_loggable :except => [ :create, :update ]).

A few things you need to keep in mind with ActsAsLoggable are:
1.) It only records create, update, and destroy actions.
2.) AAL was built using RestfulAuthentication as my User authentication module which doesn't really mean anything other than it assumes you're working with a User model and assumes the User's session is stored as current_user. That can be easily changed if you working with a different setup

USAGE:

1.) Install the plugin
  ./script/plugin install git://github.com/joshnabbott/acts_as_loggable.git

2.) Run plugin generator
  ./script/generate acts_as_loggable

3.) Add these lines to app/models/user.rb:
  cattr_accessor :current_user
  has_many :action_logs

4.) Add this to application_controller.rb:
  before_filter do |controller|
    User.current_user = controller.instance_eval { current_user }
  end

5.) Add to any model you want to be action logged
  acts_as_loggable

Copyright (c) 2008 Joshua Abbott, released under the MIT license

acts_as_loggable's People

Contributors

joshnabbott avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.