Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 6 commits
  • 1 file changed
  • 0 comments
  • 2 contributors
Oct 08, 2012
Peterpengnz peterzatncs Merge pull request #1 from peterpengnz/patch-1
Update README.textile
38bc034
Oct 09, 2012
Peter Zhang Update README.textile
added documentation for globally turning ChangeLog off.
2b7fa19
Dec 19, 2012
Peterpengnz peterzatncs Merge pull request #2 from peterpengnz/patch-2
add instructions to connect to different database
71252a1
Peter Zhang Merge pull request #1 from peterzatncs/master
update new changes
e13b4db
Dec 20, 2012
Peter Zhang add instructions to connect to different database
change_logs can save all transactions into separate database 
03b19a6
Peterpengnz peterzatncs wording 51764d5

Showing 1 changed file with 31 additions and 6 deletions. Show diff stats Hide diff stats

  1. +31 6 README.textile
37 README.textile
Source Rendered
@@ -116,16 +116,41 @@ ChangeLogs.find(:all,:conditions=>['user = ?', 'peterz'])</code></pre>
116 116 <pre><code># List all changes for table 'accounts'
117 117 ChangeLogs.find(:all,:conditions=>['table_name = ?', 'accounts'])</code></pre>
118 118
119   -* Note:
120   - It is ok if you want to use other table name instead of 'change_logs',
121   - choose your preferred table name and run the migration.
122   - Just remember in your environment.rb file, you need to tell change_log gem
123   - what is your table name:
  119 + 4. *Turn ChangeLogs off in testing environment*
  120 +You can globally turn it off for your testing.
  121 +<pre><code># config/environment.rb
  122 +ChangeLog.enabled = false if RAILS_ENV == 'test'
  123 +</code></pre>
  124 +
  125 + 5. *Database and table name*
  126 +change_log gem can save changes into separate database from the main application.
  127 +The database could be MySQL, SQLite or any other database that active record is happy to connect with.
  128 +
  129 +Here is an example of database.yml when using separate database for 'change_logs':
  130 +<pre><code>change_logs:
  131 + adapter: mysql2
  132 + encoding: utf8
  133 + database: change_logs
  134 + username: username
  135 + password: ********
  136 + host: hostname
  137 + port: 3306
  138 +</code></pre>
  139 +
  140 +And also you need to tell change_log gem to establish the connection.
  141 +<pre><code># config/environment.rb
  142 +ChangeLogs.establish_connection(:change_logs)
  143 +</code></pre>
  144 +
  145 +Table name is also configurable. Instead of 'change_logs', choose your preferred table name and run the migration.
  146 +Just remember in your environment.rb file, you need to tell change_log gem
  147 +what is your table name:
124 148
125 149 <pre><code># config/environment.rb
126 150 ChangeLogs.set_table_name('hr_maintenances')
127 151 </code></pre>
128 152
  153 +
129 154 h2. Wish List
130 155 Please email me if you have any enquiry.
131 156
@@ -136,4 +161,4 @@ h3. Author
136 161 Peter Zhang at NCS New Zealand.
137 162 Email: peterz@ncs.co.nz
138 163
139   -Copyright (c) 2011 Peter Zhang and NCS LTD, released under the MIT license
  164 +Copyright (c) 2011 Peter Zhang and NCS LTD, released under the MIT license

No commit comments for this range

Something went wrong with that request. Please try again.