Browse files

make readme to rdoc and update rdoc

  • Loading branch information...
1 parent 2d89fed commit 30096fc366c5d9e10304715e82e95c87be91b25a @grosser grosser committed Aug 9, 2010
View
2 Rakefile
@@ -17,7 +17,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Userstamp'
rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE')
+ rdoc.rdoc_files.include('Readme.rdoc', 'CHANGELOG', 'LICENSE')
rdoc.rdoc_files.include('lib/**/*.rb')
end
View
0 README → Readme.rdoc
File renamed without changes.
View
8 rdoc/classes/Ddb/Userstamp.html
@@ -55,6 +55,10 @@
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
+ <a href="../../files/lib/stamper_rb.html">
+ lib/stamper.rb
+ </a>
+ <br />
<a href="../../files/lib/migration_helper_rb.html">
lib/migration_helper.rb
</a>
@@ -63,10 +67,6 @@
lib/stampable.rb
</a>
<br />
- <a href="../../files/lib/stamper_rb.html">
- lib/stamper.rb
- </a>
- <br />
</td>
</tr>
View
79 rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html
@@ -124,48 +124,50 @@ <h3 class="section-bar">Public Instance methods</h3>
:creator_attribute =&gt; :create_user,
:updater_attribute =&gt; :update_user,
:deleter_attribute =&gt; :delete_user
+ :deleter =&gt; true
end
</pre>
<p>
The method will automatically setup all the associations, and create
<tt>before_save</tt> and <tt>before_create</tt> filters for doing the
-stamping.
+stamping. By default, the deleter association and before filter are not
+defined unless you are using acts_as_paranoid or you set the
+:deleter_attribute or set the :deleter option to true.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000005-source">
<pre>
- <span class="ruby-comment cmt"># File lib/stampable.rb, line 68</span>
-68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stampable</span>(<span class="ruby-identifier">options</span> = {})
-69: <span class="ruby-identifier">defaults</span> = {
-70: <span class="ruby-identifier">:stamper_class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:user</span>,
-71: <span class="ruby-identifier">:creator_attribute</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">created_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:creator_id</span>,
-72: <span class="ruby-identifier">:updater_attribute</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">updated_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:updater_id</span>,
-73: <span class="ruby-identifier">:deleter_attribute</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">deleted_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:deleter_id</span>
-74: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
-75:
-76: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:stamper_class_name</span>].<span class="ruby-identifier">to_sym</span>
-77: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">creator_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:creator_attribute</span>].<span class="ruby-identifier">to_sym</span>
-78: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updater_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:updater_attribute</span>].<span class="ruby-identifier">to_sym</span>
-79: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deleter_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:deleter_attribute</span>].<span class="ruby-identifier">to_sym</span>
+ <span class="ruby-comment cmt"># File lib/stampable.rb, line 71</span>
+71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stampable</span>(<span class="ruby-identifier">options</span> = {})
+72: <span class="ruby-identifier">compatability</span> = <span class="ruby-constant">Ddb</span><span class="ruby-operator">::</span><span class="ruby-constant">Userstamp</span>.<span class="ruby-identifier">compatibility_mode</span>
+73: <span class="ruby-identifier">defaults</span> = {
+74: <span class="ruby-identifier">:stamper_class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:user</span>,
+75: <span class="ruby-identifier">:creator_attribute</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">compatability</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">created_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:creator_id</span>),
+76: <span class="ruby-identifier">:updater_attribute</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">compatability</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">updated_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:updater_id</span>),
+77: <span class="ruby-identifier">:deleter_attribute</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">compatability</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">deleted_by</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:deleter_id</span>),
+78: <span class="ruby-identifier">:deleter</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-operator">!</span><span class="ruby-operator">!</span>(<span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:deleter_attribute</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Caboose</span><span class="ruby-operator">::</span><span class="ruby-constant">Acts</span><span class="ruby-operator">::</span><span class="ruby-constant">Paranoid</span>))
+79: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
80:
-81: <span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
-82: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:creator</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">singularize</span>.<span class="ruby-identifier">camelize</span>,
-83: <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">creator_attribute</span>
-84:
-85: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:updater</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">singularize</span>.<span class="ruby-identifier">camelize</span>,
-86: <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updater_attribute</span>
-87:
-88: <span class="ruby-identifier">before_save</span> <span class="ruby-identifier">:set_updater_attribute</span>
-89: <span class="ruby-identifier">before_create</span> <span class="ruby-identifier">:set_creator_attribute</span>
-90:
-91: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Caboose</span><span class="ruby-operator">::</span><span class="ruby-constant">Acts</span><span class="ruby-operator">::</span><span class="ruby-constant">Paranoid</span>)
-92: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:deleter</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span>,
-93: <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deleter_attribute</span>
-94: <span class="ruby-identifier">before_destroy</span> <span class="ruby-identifier">:set_deleter_attribute</span>
-95: <span class="ruby-keyword kw">end</span>
-96: <span class="ruby-keyword kw">end</span>
-97: <span class="ruby-keyword kw">end</span>
+81: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">stamper_class_name</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:stamper_class_name</span>].<span class="ruby-identifier">to_sym</span>
+82: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">creator_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:creator_attribute</span>].<span class="ruby-identifier">to_sym</span>
+83: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updater_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:updater_attribute</span>].<span class="ruby-identifier">to_sym</span>
+84: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">deleter_attribute</span> = <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:deleter_attribute</span>].<span class="ruby-identifier">to_sym</span>
+85:
+86: <span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
+87: <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">stamper_class_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">singularize</span>.<span class="ruby-identifier">camelize</span>
+88: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:creator</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">creator_attribute</span>
+89: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:updater</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">updater_attribute</span>
+90:
+91: <span class="ruby-identifier">before_save</span> <span class="ruby-identifier">:set_updater_attribute</span>
+92: <span class="ruby-identifier">before_create</span> <span class="ruby-identifier">:set_creator_attribute</span>
+93:
+94: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">defaults</span>[<span class="ruby-identifier">:deleter</span>]
+95: <span class="ruby-identifier">belongs_to</span> <span class="ruby-identifier">:deleter</span>, <span class="ruby-identifier">:class_name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">:foreign_key</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">deleter_attribute</span>
+96: <span class="ruby-identifier">before_destroy</span> <span class="ruby-identifier">:set_deleter_attribute</span>
+97: <span class="ruby-keyword kw">end</span>
+98: <span class="ruby-keyword kw">end</span>
+99: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
@@ -195,13 +197,14 @@ <h3 class="section-bar">Public Instance methods</h3>
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000006-source">
<pre>
- <span class="ruby-comment cmt"># File lib/stampable.rb, line 106</span>
-106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">without_stamps</span>
-107: <span class="ruby-identifier">original_value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span>
-108: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span> = <span class="ruby-keyword kw">false</span>
-109: <span class="ruby-keyword kw">yield</span>
-110: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span> = <span class="ruby-identifier">original_value</span>
-111: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/stampable.rb, line 108</span>
+108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">without_stamps</span>
+109: <span class="ruby-identifier">original_value</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span>
+110: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span> = <span class="ruby-keyword kw">false</span>
+111: <span class="ruby-keyword kw">yield</span>
+112: <span class="ruby-keyword kw">ensure</span>
+113: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">record_userstamp</span> = <span class="ruby-identifier">original_value</span>
+114: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
View
2 rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html
@@ -151,7 +151,7 @@ <h3 class="section-bar">Public Instance methods</h3>
<pre>
<span class="ruby-comment cmt"># File lib/stamper.rb, line 30</span>
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stamper</span>
-31: <span class="ruby-identifier">find</span>(<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">&quot;#{self.to_s.downcase}_#{self.object_id}_stamper&quot;</span>])
+31: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-node">&quot;#{self.to_s.downcase}_#{self.object_id}_stamper&quot;</span>]
32: <span class="ruby-keyword kw">end</span>
</pre>
</div>
View
118 rdoc/classes/Userstamp.html
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Module: Userstamp</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Module</strong></td>
+ <td class="class-name-in-header">Userstamp</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/userstamp_rb.html">
+ lib/userstamp.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+ <div id="constants-list">
+ <h3 class="section-bar">Constants</h3>
+
+ <div class="name-list">
+ <table summary="Constants">
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">VERSION</td>
+ <td>=</td>
+ <td class="context-item-value">File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
View
2 rdoc/created.rid
@@ -1 +1 @@
-Sat, 05 Apr 2008 15:11:35 -0600
+Mon, 09 Aug 2010 20:57:24 +0200
View
2 rdoc/files/CHANGELOG.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat Apr 05 11:41:29 -0600 2008</td>
+ <td>Fri Apr 30 22:27:47 +0200 2010</td>
</tr>
</table>
</div>
View
2 rdoc/files/LICENSE.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Tue Mar 11 20:24:59 -0600 2008</td>
+ <td>Fri Apr 30 22:27:46 +0200 2010</td>
</tr>
</table>
</div>
View
123 rdoc/files/README.html → rdoc/files/Readme_rdoc.html
@@ -5,7 +5,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>File: README</title>
+ <title>File: Readme.rdoc</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
@@ -47,16 +47,16 @@
<div id="fileHeader">
- <h1>README</h1>
+ <h1>Readme.rdoc</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
- <td>README
+ <td>Readme.rdoc
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat Apr 05 15:01:24 -0600 2008</td>
+ <td>Mon Aug 09 20:56:23 +0200 2010</td>
</tr>
</table>
</div>
@@ -69,10 +69,12 @@
<div id="contextContent">
<div id="description">
- <h1>Userstamp Plugin (v 2.0)</h1>
+ <p>
+<a href="../classes/Userstamp.html">Userstamp</a>
+</p>
<h2>Overview</h2>
<p>
-The Userstamp Plugin extends <a
+<a href="../classes/Userstamp.html">Userstamp</a> extends <a
href="http://api.rubyonrails.com/classes/ActiveRecord/Base.html">ActiveRecord::Base</a>
to add automatic updating of &#8216;creator&#8217;, &#8216;updater&#8217;,
and &#8216;deleter&#8217; attributes. It is based loosely on the <a
@@ -87,46 +89,35 @@
to being created, updated, or deleted by &#8216;stampers&#8217;.
</p>
<h2>Installation</h2>
-<p>
-Installation of the plugin can be done using the built in Rails plugin
-script. Issue the following command from the root of your application:
-</p>
<pre>
- script/plugin install git://github.com/delynn/userstamp.git
+ - As Rails plugin: `script/plugin install git://github.com/delynn/userstamp.git `
+ - As gem: ` sudo gem install userstamp `
</pre>
-<p>
-Once installed you will need to restart your application for the plugin to
-be loaded into the Rails environment.
-</p>
-<p>
-You might also be interested in using <a
-href="http://piston.rubyforge.org/index.html">Piston</a> to manage the
-importing and future updating of this plugin.
-</p>
<h2>Usage</h2>
<p>
-In this new version of the Userstamp plug-in, the assumption is that you
-have two different categories of objects; those that mani˝pulate, and
-those that are manipulated. For those objects that are being manipulated
-there&#8216;s the Stampable module and for the manipulators there&#8216;s
-the Stamper module. There&#8216;s also the actual Userstamp module for your
+The assumption is that you have two different categories of objects; those
+that manipulate, and those that are manipulated. For those objects that are
+being manipulated there&#8216;s the Stampable module and for the
+manipulators there&#8216;s the Stamper module. There&#8216;s also the
+actual <a href="../classes/Userstamp.html">Userstamp</a> module for your
controllers that assists in setting up your environment on a per request
basis.
</p>
+<h3>Example</h3>
<p>
-To better understand how all this works, I think an example is in order.
-For this example we will assume that a weblog application is comprised of
-User and Post objects. The first thing we need to do is create the
-migrations for these objects, and the plug-in gives you a
-<tt>userstamps</tt> method for very easily doing this:
+Assume a weblog application has User and Post objects.
</p>
+<ol>
+<li>Create the migrations for these objects
+
+</li>
+</ol>
<pre>
class CreateUsers &lt; ActiveRecord::Migration
def self.up
create_table :users, :force =&gt; true do |t|
- t.timestamps
- t.userstamps
- t.name
+ ...
+ t.userstamps # use t.userstamps(true) if you also want 'deleter_id'
end
end
@@ -138,9 +129,8 @@
class CreatePosts &lt; ActiveRecord::Migration
def self.up
create_table :posts, :force =&gt; true do |t|
- t.timestamps
- t.userstamps
- t.title
+ ...
+ t.userstamps # use t.userstamps(true) if you also want 'deleter_id'
end
end
@@ -149,19 +139,26 @@
end
end
</pre>
+<ol>
+<li>Users are going to manipulate Post&#8216;s, use the
+
+</li>
+</ol>
<p>
-Second, since Users are going to manipulate other objects in our project,
-we&#8216;ll use the <tt>model_stamper</tt> method in our User class:
+<tt>model_stamper</tt>:
</p>
<pre>
class User &lt; ActiveRecord::Base
model_stamper
end
</pre>
+<ol>
+<li>Setup a controller to set the current user of the application. It&#8216;s
+
+</li>
+</ol>
<p>
-Finally, we need to setup a controller to set the current user of the
-application. It&#8216;s recommended that you do this in your
-ApplicationController:
+recommended that you do this in your ApplicationController:
</p>
<pre>
class ApplicationController &lt; ActionController::Base
@@ -207,19 +204,15 @@
end
</pre>
<p>
-The big change with this new version is that we are now using
-Thread.current to save the current stamper so as to avoid conflict with
-concurrent requests.
-</p>
-<p>
The <tt>stampable</tt> method allows you to customize what columns will get
stamped, and also creates the <tt>creator</tt>, <tt>updater</tt>, and
<tt>deleter</tt> associations.
</p>
<p>
-The Userstamp module that we included into our ApplicationController uses
-the setter method to set which user is currently making the request. By
-default the &#8216;set_stampers&#8217; method works perfectly with the <a
+The <a href="../classes/Userstamp.html">Userstamp</a> module that we
+included into our ApplicationController uses the setter method to set which
+user is currently making the request. By default the
+&#8216;set_stampers&#8217; method works perfectly with the <a
href="http://svn.techno-weenie.net/projects/plugins/restful_authentication">RestfulAuthentication</a>
plug-in:
</p>
@@ -231,7 +224,8 @@
<p>
If you aren&#8216;t using ActsAsAuthenticated, then you need to create your
own version of the <tt>set_stampers</tt> method in the controller where
-you&#8216;ve included the Userstamp module.
+you&#8216;ve included the <a href="../classes/Userstamp.html">Userstamp</a>
+module.
</p>
<p>
Now, let&#8216;s get back to the Stampable module (since it really is the
@@ -246,25 +240,27 @@
</p>
<pre>
class Post &lt; ActiveRecord::Base
- acts_as_stampable :stamper_class_name =&gt; :person,
- :creator_attribute =&gt; :create_user,
- :updater_attribute =&gt; :update_user,
- :deleter_attribute =&gt; :delete_user
+ stampable :stamper_class_name =&gt; :person,
+ :creator_attribute =&gt; :create_user,
+ :updater_attribute =&gt; :update_user,
+ :deleter_attribute =&gt; :delete_user
end
</pre>
<p>
-If you are upgrading your application from the old version of Userstamp,
-there is a compatibility mode to have the plug-in use the old
-&quot;_by&quot; columns by default. To enable this mode, add the following
-line to the RAILS_ROOT/config/environment.rb file:
+If you are upgrading your application from the old version of <a
+href="../classes/Userstamp.html">Userstamp</a>, there is a compatibility
+mode to have the plug-in use the old &quot;_by&quot; columns by default. To
+enable this mode, add the following line to the
+RAILS_ROOT/config/environment.rb file:
</p>
<pre>
Ddb::Userstamp.compatibility_mode = true
</pre>
<p>
-If you are having a difficult time getting the Userstamp plug-in to work, I
-recommend you checkout the sample application that I created. You can find
-this application on <a
+If you are having a difficult time getting the <a
+href="../classes/Userstamp.html">Userstamp</a> plug-in to work, I recommend
+you checkout the sample application that I created. You can find this
+application on <a
href="http://github.com/delynn/userstamp_sample">GitHub</a>
</p>
<h2>Uninstall</h2>
@@ -306,6 +302,11 @@
href="http://wiki.rubyonrails.com/rails/pages/ExtendingActiveRecordExample">Extending
ActiveRecord</a>.
</p>
+<h2>Contributors / maintenance / enhancement</h2>
+<pre>
+ - {Michael Grosser}[http://pragmatig.com]
+ - {John Dell}[http://blog.spovich.com/]
+</pre>
</div>
View
2 rdoc/files/lib/migration_helper_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat Apr 05 11:37:18 -0600 2008</td>
+ <td>Mon Aug 09 20:17:35 +0200 2010</td>
</tr>
</table>
</div>
View
2 rdoc/files/lib/stampable_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat Apr 05 14:16:35 -0600 2008</td>
+ <td>Mon Aug 09 20:36:07 +0200 2010</td>
</tr>
</table>
</div>
View
2 rdoc/files/lib/stamper_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat Apr 05 14:16:03 -0600 2008</td>
+ <td>Mon Aug 09 20:17:35 +0200 2010</td>
</tr>
</table>
</div>
View
11 rdoc/files/lib/userstamp_rb.html
@@ -56,7 +56,7 @@
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
- <td>Sat Apr 05 14:57:26 -0600 2008</td>
+ <td>Mon Aug 09 20:18:00 +0200 2010</td>
</tr>
</table>
</div>
@@ -69,6 +69,15 @@
<div id="contextContent">
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ stamper&nbsp;&nbsp;
+ stampable&nbsp;&nbsp;
+ migration_helper&nbsp;&nbsp;
+ </div>
+ </div>
</div>
View
1 rdoc/fr_class_index.html
@@ -31,6 +31,7 @@ <h1 class="section-bar">Classes</h1>
<a href="classes/Ddb/Userstamp/Stamper.html">Ddb::Userstamp::Stamper</a><br />
<a href="classes/Ddb/Userstamp/Stamper/ClassMethods.html">Ddb::Userstamp::Stamper::ClassMethods</a><br />
<a href="classes/Ddb/Userstamp/Stamper/InstanceMethods.html">Ddb::Userstamp::Stamper::InstanceMethods</a><br />
+ <a href="classes/Userstamp.html">Userstamp</a><br />
</div>
</div>
</body>
View
2 rdoc/fr_file_index.html
@@ -22,7 +22,7 @@ <h1 class="section-bar">Files</h1>
<div id="index-entries">
<a href="files/CHANGELOG.html">CHANGELOG</a><br />
<a href="files/LICENSE.html">LICENSE</a><br />
- <a href="files/README.html">README</a><br />
+ <a href="files/Readme_rdoc.html">Readme.rdoc</a><br />
<a href="files/lib/migration_helper_rb.html">lib/migration_helper.rb</a><br />
<a href="files/lib/stampable_rb.html">lib/stampable.rb</a><br />
<a href="files/lib/stamper_rb.html">lib/stamper.rb</a><br />
View
2 rdoc/index.html
@@ -19,6 +19,6 @@
<frame src="fr_class_index.html" name="Classes" />
<frame src="fr_method_index.html" name="Methods" />
</frameset>
- <frame src="files/README.html" name="docwin" />
+ <frame src="files/Readme_rdoc.html" name="docwin" />
</frameset>
</html>

0 comments on commit 30096fc

Please sign in to comment.