canvas-lms/vendor/plugins/simply_versioned/rdoc/files
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00
..
lib Initial commit. 2011-01-31 18:57:29 -07:00
README.html Initial commit. 2011-01-31 18:57:29 -07:00

README.html

<?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>File: README</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="fileHeader">
    <h1>README</h1>
    <table class="header-table">
    <tr class="top-aligned-row">
      <td><strong>Path:</strong></td>
      <td>README
      </td>
    </tr>
    <tr class="top-aligned-row">
      <td><strong>Last Update:</strong></td>
      <td>Sun Dec 30 11:51:41 +0000 2007</td>
    </tr>
    </table>
  </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
SimplyVersioned
</p>
<h6>=========</h6>
<p>
Release: 0.2 Date: 30-12-2007 Author: Matt Mower &lt;self@mattmower.com&gt;
</p>
<p>
SimplyVersioned is a simple, non-invasive, approach to versioning
ActiveRecord models.
</p>
<p>
SimplyVersioned does not require any structural change to the models to be
versioned and requires only one versions table to be created (a migration
generator is supplied with the plugin) regardless of the number of models
being versioned.
</p>
<p>
The plugin introduces a &#8216;Version&#8217; ActiveRecord model (that
reflects changes to model attributes) to which versioned models are
polymorphically associated. Version records store the model information as
a YAML hash.
</p>
<p>
SimplyVersioned meets a simple need for model versioning. If your needs are
more complex maybe try Rick Olsen&#8216;s acts_as_versioned (<a
href="http://svn.techno-weenie.net/projects/plugins/acts_as_versioned">svn.techno-weenie.net/projects/plugins/acts_as_versioned</a>/).
</p>
<p>
SimplyVersioned has (so far) been tested and found to work with Rails 2.0.1
and Ruby 1.8.6p111.
</p>
<p>
Usage
</p>
<h5></h5>
<ol>
<li>Install the plugin

</li>
</ol>
<pre>
  ./script/plugin install http://rubymatt.rubyforge.org/svn/simply_versioned
</pre>
<ol>
<li>Generate the migration

</li>
</ol>
<pre>
  ./script/generate simply_versioned_migration
</pre>
<ol>
<li>Create the versions table

</li>
</ol>
<pre>
  rake db:migrate
</pre>
<ol>
<li>Annotate the models you want to version specifying how many versions to
keep

<pre>
     class Thing &lt; ActiveRecord::Base
       simply_versioned :keep =&gt; 10
     end
</pre>
</li>
<li>Create versions

<pre>
     thing = Thing.create!( :foo =&gt; bar ) # creates v1
     thing.foo = baz
     thing.save! # creates v2
</pre>
</li>
<li>Find versions

<pre>
     thing.versions.each do |version| ... end
     render :partial =&gt; 'thing_version', :collection =&gt; thing.versions
     thing.versions.current
     thing.versions.first
     thing.versions.get( 3 )
</pre>
</li>
<li>Revert to a previous version

<pre>
     thing.revert_to_version( 5 )
</pre>
</li>
<li>Traverse versions

<pre>
     thing.versions.current.previous
     thing.versions.first.next
</pre>
</li>
<li>Obtain a copy of a previous versioned model

<pre>
     thing.versions.first.model # =&gt; Instantiated Thing with versioned values
</pre>
</li>
</ol>
<p>
Copyright (c) 2007 Matt Mower &lt;self@mattmower.com&gt; and released under
the MIT license
</p>

    </div>


   </div>


  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- 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>