• R/O
  • HTTP
  • SSH
  • HTTPS

context_monitor: Repository summary

This Rails plugin provides the capability for monitoring operations (create/update).


Recent Commits RSS

Rev. Time Author Message
3884173 2009-12-09 14:58:16 (del#39370) master initialize repository

Branches

Name Rev. Time Author Message
master 3884173 2009-12-09 14:58:16 (del#39370) initialize repository

README

ContextMonitor
===========

This plugin provides the capability for monitoring operations (create/update).

Example
=======

  ActiveRecord::Schema.define(:version => 0) do
    create_table :articles do |t|
      t.string  :name
      t.integer :created_by_id
      t.integer :updated_by_id
      t.timestamps
    end
  end

  class Article < ActiveRecord::Base
    context_monitor :user, :suffix => 'by'
  end

  User.current = User.find(10)
  article = Article.create!(:name => 'example')
  p article.created_by.id # 10
  p article.updated_by.id # 10
  p article.created_by == User.current # true
  p article.updated_by == User.current # true

  User.current = User.find(20)
  article.name = 'test'
  p article.created_by.id # 10
  p article.updated_by.id # 20
  p article.created_by == User.current # false
  p article.updated_by == User.current # true


Copyright (c) 2008 Good-Day, Inc
Show on old repository browser