diff --git a/README.md b/README.md index ae4cd8a4..35ed875e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ PaperTrail is assailed with hundreds of test assertions for each release. Data i # updated_at: #Ecto.DateTime<2016-09-15 21:42:38>}, # item_id: 1, item_type: "Post", originator_id: nil, originator: nil, meta: nil}}} - # => on error(it matches Repo.insert\2): + # => on error(it matches Repo.insert/2): # {:error, Ecto.Changeset, @@ -53,7 +53,7 @@ PaperTrail is assailed with hundreds of test assertions for each release. Data i # item_id: 1, item_type: "Post", originator_id: nil, originator: nil # meta: nil}}} - # => on error(it matches Repo.update\2): + # => on error(it matches Repo.update/2): # {:error, Ecto.Changeset, @@ -116,7 +116,7 @@ The library source code is minimal and well tested. It is suggested to read the 3. install and compile your dependency: - ```mix deps.compile``` + ```mix deps.get && mix deps.compile``` 4. run this command to generate the migration: @@ -142,7 +142,7 @@ YES! Make sure you do the steps above. | item_changes | Map | all the changes in this version as a map | Library generates | | originator_id | Integer | foreign key reference to the creator/owner of this change | Optionally set | | origin | String | short reference to origin(eg. worker:activity-checker, migration, admin:33) | Optionally set | -| meta | Map | any extra optional meta information about the version(eg. %{slug: "ausername"}) | Optionally set | +| meta | Map | any extra optional meta information about the version(eg. %{slug: "ausername", important: true}) | Optionally set | | inserted_at | Date | inserted_at timestamp | Ecto generates | ### Version origin references: @@ -153,6 +153,10 @@ PaperTrail.update(changeset, origin: "migration") PaperTrail.update(changeset, origin: "user:1234") # or: PaperTrail.delete(changeset, origin: "worker:delete_inactive_users") +# or: +PaperTrail.insert(new_user_changeset, origin: "password_registration") +# or: +PaperTrail.insert(new_user_changeset, origin: "facebook_registration") ``` ### Originator relationships @@ -259,7 +263,7 @@ edited_company = Company.changeset(company, %{name: "Acme Inc."}) |> PaperTrail. Additionally, you can put a null constraint on ```origin``` column, you should always put an ```origin``` reference to describe who makes the change. This is important for big applications because a model can change from many sources. ### Storing version meta data -You might want to add some meta data that doesn't belong to ``originator_id`` and ``origin`` fields. Such data could be stored in one object named ```meta``` in paper_trail versions. Meta field could be passed as the second optional parameter to PaperTrail.insert\\2, PaperTrail.update\\2, PaperTrail.delete\\2 functions: +You might want to add some meta data that doesn't belong to ``originator_id`` and ``origin`` fields. Such data could be stored in one object named ```meta``` in paper_trail versions. Meta field could be passed as the second optional parameter to PaperTrail.insert/2, PaperTrail.update/2, PaperTrail.delete/2 functions: ```elixir company = Company.changeset(%Company{}, %{name: "Acme Inc."}) @@ -278,5 +282,15 @@ deleted_company = Company.changeset(edited_company, %{}) - don't delete your paper_trail versions, instead you can merge them - If you have a question or a problem, do not hesitate to create an issue or submit a pull request -## TODO: -** remove wrong Elixir compiler errors +# Credits +Many thanks to: + +[Jose Pablo Castro](https://github.com/josepablocastro) - Built the repo configuration for paper_trail +[Alex Antonov](https://github.com/asiniy) - Original inventor of the originator feature +[Josh Taylor](https://github.com/joshuataylor) - Maintenance and new feature suggestions +[Mitchell Henke](https://github.com/mitchellhenke) - Fixed weird elixir compiler warnings +[Izel Nakri](https://github.com/izelnakri) - The Originator of this library. See what I did there ;) + +Additional thanks to: +[Ruby paper_trail gem](https://github.com/airblade/paper_trail) - Initial inspiration of this project. +[Ecto](https://github.com/elixir-ecto/ecto) - For the great API. diff --git a/doc/404.html b/doc/404.html index cf9cd57c..b901414e 100644 --- a/doc/404.html +++ b/doc/404.html @@ -5,7 +5,7 @@ - 404 – paper_trail v0.6.2 + 404 – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

diff --git a/doc/Mix.Tasks.Papertrail.Install.html b/doc/Mix.Tasks.Papertrail.Install.html index 6530874c..b6e2ea7a 100644 --- a/doc/Mix.Tasks.Papertrail.Install.html +++ b/doc/Mix.Tasks.Papertrail.Install.html @@ -5,7 +5,7 @@ - Mix.Tasks.Papertrail.Install – paper_trail v0.6.2 + Mix.Tasks.Papertrail.Install – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 Mix.Tasks.Papertrail.Install diff --git a/doc/PaperTrail.Migration.html b/doc/PaperTrail.Migration.html index ee2026c1..ff4d0be5 100644 --- a/doc/PaperTrail.Migration.html +++ b/doc/PaperTrail.Migration.html @@ -5,7 +5,7 @@ - PaperTrail.Migration – paper_trail v0.6.2 + PaperTrail.Migration – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 PaperTrail.Migration diff --git a/doc/PaperTrail.RepoClient.html b/doc/PaperTrail.RepoClient.html index 83dd85b9..311876a8 100644 --- a/doc/PaperTrail.RepoClient.html +++ b/doc/PaperTrail.RepoClient.html @@ -5,7 +5,7 @@ - PaperTrail.RepoClient – paper_trail v0.6.2 + PaperTrail.RepoClient – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 PaperTrail.RepoClient diff --git a/doc/PaperTrail.Version.html b/doc/PaperTrail.Version.html index 1fb6468d..0cd6be23 100644 --- a/doc/PaperTrail.Version.html +++ b/doc/PaperTrail.Version.html @@ -5,7 +5,7 @@ - PaperTrail.Version – paper_trail v0.6.2 + PaperTrail.Version – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 PaperTrail.Version diff --git a/doc/PaperTrail.VersionQueries.html b/doc/PaperTrail.VersionQueries.html index 8455ef9f..f212cc92 100644 --- a/doc/PaperTrail.VersionQueries.html +++ b/doc/PaperTrail.VersionQueries.html @@ -5,7 +5,7 @@ - PaperTrail.VersionQueries – paper_trail v0.6.2 + PaperTrail.VersionQueries – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 PaperTrail.VersionQueries diff --git a/doc/PaperTrail.html b/doc/PaperTrail.html index 3b51a0aa..f376ccb9 100644 --- a/doc/PaperTrail.html +++ b/doc/PaperTrail.html @@ -5,7 +5,7 @@ - PaperTrail – paper_trail v0.6.2 + PaperTrail – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 PaperTrail diff --git a/doc/api-reference.html b/doc/api-reference.html index e528d65e..7eed0c0b 100644 --- a/doc/api-reference.html +++ b/doc/api-reference.html @@ -5,7 +5,7 @@ - API Reference – paper_trail v0.6.2 + API Reference – paper_trail v0.6.3 @@ -28,7 +28,7 @@

paper_trail

@@ -60,7 +60,7 @@

- paper_trail v0.6.2 + paper_trail v0.6.3 API Reference

diff --git a/doc/index.html b/doc/index.html index 0aad5829..5e30ee32 100644 --- a/doc/index.html +++ b/doc/index.html @@ -2,7 +2,7 @@ - paper_trail v0.6.2 – Documentation + paper_trail v0.6.3 – Documentation diff --git a/mix.exs b/mix.exs index 41466808..e4bbf7cd 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule PaperTrail.Mixfile do def project do [ app: :paper_trail, - version: "0.6.2", + version: "0.6.3", elixir: "~> 1.4", description: description(), build_embedded: Mix.env == :prod,