This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 84d5014e5edaf7d4dc05c560228e66211d045e83
tree 17f771c259bced64cd03a86152477e73c35515ff
parent e0440629fbbed6e8e6a888af3a9fd23df2ae046e parent 67d107c26fbef72ad99dd0c62e70e60cbb3f63d7
tree 17f771c259bced64cd03a86152477e73c35515ff
parent e0440629fbbed6e8e6a888af3a9fd23df2ae046e parent 67d107c26fbef72ad99dd0c62e70e60cbb3f63d7
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Tue Dec 02 20:01:31 -0800 2008 | |
| |
README | Sun Dec 21 18:23:08 -0800 2008 | |
| |
Rakefile | Fri Dec 05 12:08:06 -0800 2008 | |
| |
generators/ | Fri Dec 12 10:48:19 -0800 2008 | |
| |
init.rb | Sat Nov 29 02:02:14 -0800 2008 | |
| |
lib/ | Wed Dec 31 14:12:42 -0800 2008 | |
| |
rails/ | Fri Jan 23 13:38:17 -0800 2009 | |
| |
spec/ | Fri Dec 12 10:48:19 -0800 2008 |
README
= ActsLikeGit
ALG automagically saves the history of a given text or string field. It sits over the top of an ActiveRecord model;
after a value is committed to the database, the plugin writes the new value to a text file and commits it to a git
repository. This way you get all the advantages of using Git as version-control.
Note: this plugin does not play nice with other plugins which override the getters and setters on your model. So if, for
example, you're creating a permalink on the same column as the versioning, you're going to run into problems due to the
inherent complexity in define_attribute_methods.
== Usage
Declare which attributes are to be versioned:
class Post < ActiveRecord::Base
versioning(:title) do |version|
version.repository = '/home/git/repositories/postal.git'
version.message = lambda { |post| "Committed by #{post.author.name}" }
end
end
To view the complete list of changes:
>> @post = Post.find 15
<Post:15>
>> @post.title
=> 'Freddy'
>> @post.history(:title)
=> ['Joe', 'Frank', 'Freddy]
>> @post.log
=> ['bfec2f69e270d2d02de4e8c7a4eb2bd0f132bdbb', '643deb45c12982dde75ba71657792a2dbdda83e6',
'1ce6c7368219db7698f4acc3417e656510b4138d']
>> @post.revert_to '1ce6c7368219db7698f4acc3417e656510b4138d'
>> @post.title
=> 'Joe'
Copyright (c) 2008 [Jamie van Dyke, Courtenay Gasking, Scott Chacon, Roman Le Négrate], released under the MIT license.







