change_log 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +19 -2
- data/lib/change_log/maintenance.rb +3 -3
- data/lib/change_log/version.rb +1 -1
- metadata +4 -4
data/README.textile
CHANGED
@@ -7,8 +7,11 @@ h2. Install Change Log Gem
|
|
7
7
|
|
8
8
|
1. by command:
|
9
9
|
<pre><code># gem install change_log</code></pre>
|
10
|
+
Then in your environment.rb:
|
11
|
+
<pre><code>config.gem 'change_log'</code></pre>
|
10
12
|
|
11
|
-
|
13
|
+
|
14
|
+
2. by bundler:
|
12
15
|
<pre><code># Gemfile in your application
|
13
16
|
gem 'change_log'
|
14
17
|
</code></pre>
|
@@ -16,6 +19,10 @@ gem 'change_log'
|
|
16
19
|
Then:
|
17
20
|
<pre><code>bundle install</code></pre>
|
18
21
|
|
22
|
+
* Note: Currently if you use bundler to load gems and phusion-passenger as your web server,
|
23
|
+
you may get "enable_change_log" method missing error.
|
24
|
+
I am still looking for reason for that, helps will be pleased!
|
25
|
+
|
19
26
|
h2. Create a table to keep all maintenance logs
|
20
27
|
|
21
28
|
Generate a migration file
|
@@ -46,10 +53,20 @@ h2. Create a table to keep all maintenance logs
|
|
46
53
|
Then:
|
47
54
|
<pre><code>rake db:migrate</code></pre>
|
48
55
|
|
56
|
+
* Note: It is ok if you want to use other table name instead of 'change_logs',
|
57
|
+
choose your preferred table name and run the migration.
|
58
|
+
Just remember in your environment.rb file, you need to tell change_log gem
|
59
|
+
what is your table name:
|
60
|
+
<pre><code># config/environment.rb
|
61
|
+
Maintenance.set_table_name('hr_maintenances')
|
62
|
+
</code></pre>
|
63
|
+
|
64
|
+
* Note: Maintenance model is core ActiveRecord model used by change_log.
|
65
|
+
|
49
66
|
h2. Use Change Log
|
50
67
|
|
51
68
|
1. Include change_log in environment.rb
|
52
|
-
<pre><code>
|
69
|
+
<pre><code>config.gem 'change_log'</code></pre>
|
53
70
|
|
54
71
|
2. Add current_user method in application_controller.rb
|
55
72
|
<pre><code>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Maintenance < ActiveRecord::Base
|
2
|
-
# Set table name to "change_logs"
|
3
|
-
set_table_name 'change_logs'
|
2
|
+
# Set table name to "change_logs"
|
3
|
+
set_table_name 'change_logs'
|
4
4
|
|
5
5
|
private
|
6
6
|
|
@@ -12,7 +12,7 @@ class Maintenance < ActiveRecord::Base
|
|
12
12
|
record.save
|
13
13
|
end
|
14
14
|
|
15
|
-
# return the
|
15
|
+
# return the latest version number for this change
|
16
16
|
def self.get_version_number(id,table_name)
|
17
17
|
latest_version = Maintenance.maximum(:version,:conditions=>['record_id = ? and table_name = ?',id,table_name])
|
18
18
|
return latest_version.nil? ? 1 : latest_version.next
|
data/lib/change_log/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: change_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Zhang
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-19 00:00:00 +13:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|