@@ -18,3 +18,51 @@ Or install it yourself as:
18
18
``` bash
19
19
$ gem install code0-zero_track
20
20
```
21
+
22
+ ## Features
23
+
24
+ ### ` Code0::ZeroTrack::Context `
25
+
26
+ Context allows you to save data in a thread local object. Data from the Context is merged into the
27
+ log messages, if ` Code0::ZeroTrack::Logs::JsonFormatter ` or ` Code0::ZeroTrack::Logs::JsonFormatter::Tagged `
28
+ is used.
29
+
30
+ ` .with_context(data, &block) ` creates a new context inheriting data from the previous context and adds the
31
+ passed data to it. The new context is dropped after the block finished execution. \
32
+ ` .push(data) ` creates a new context inheriting data from the previous context and adds the passed data to it. \
33
+ ` .current ` returns the context from the top of the stack.
34
+
35
+ ### ` Code0::ZeroTrack::Memoize `
36
+
37
+ This module can be included to get access to the ` memoize(name, reset_on_change, &block) ` method.
38
+
39
+ This method allows to memoize a value, so it only gets computed once.
40
+ Each memoize is identified by the name. You can pass a proc to ` reset_on_change ` and the memoization
41
+ will automatically clear every time returned value changes.
42
+
43
+ ` memoized?(name) ` allows to check if a value for the given name is currently memoized. \
44
+ Memoizations can be cleared with ` clear_memoize(name) ` or ` clear_memoize!(name) ` .
45
+
46
+ ### ` config.zero_track.active_record.schema_cleaner `
47
+
48
+ When using ` config.active_record.schema_format = :sql ` , Rails produces a ` db/structure.sql ` .
49
+ This file contains a lot of noise that doesn't provide much value.
50
+
51
+ This noise can be cleaned out with ` config.zero_track.active_record.schema_cleaner = true ` .
52
+
53
+ ### ` config.zero_track.active_record.timestamps `
54
+
55
+ Setting ` config.zero_track.active_record.timestamps = true ` adds ` timestamps_with_timezone `
56
+ and ` datetime_with_timezone ` as methods on the table model when creating tables in migrations.
57
+
58
+ They behave just like ` timestamps ` and ` datetime ` , just including timezones.
59
+
60
+ ### ` config.zero_track.active_record.schema_migrations `
61
+
62
+ Rails uses the ` schema_migrations ` table to keep track which migrations have been executed.
63
+ This information is also persisted in the ` db/structure.sql ` , so the ` schema_migrations ` table
64
+ can be filled with the correct entries when the schema is loaded from the schema file.
65
+
66
+ This approach is prone to git conflicts, so you can switch to a file based persistence
67
+ with ` config.zero_track.active_record.schema_migrations = true ` . Instead of an ` INSERT INTO ` in
68
+ the ` db/structure.sql ` , this mode creates files in the ` db/schema_migrations ` directory.
0 commit comments