Permalink
Browse files

Merge pull request #1 from peterzatncs/master

update new changes
  • Loading branch information...
peterpengnz committed Dec 20, 2012
2 parents a5f3058 + 51764d5 commit e13b4db69e17aee277a47135d3006d346facefe7
Showing with 31 additions and 6 deletions.
  1. +31 −6 README.textile
View
@@ -116,16 +116,41 @@ ChangeLogs.find(:all,:conditions=>['user = ?', 'peterz'])</code></pre>
<pre><code># List all changes for table 'accounts'
ChangeLogs.find(:all,:conditions=>['table_name = ?', 'accounts'])</code></pre>
-* Note:
- It is ok if you want to use other table name instead of 'change_logs',
- choose your preferred table name and run the migration.
- Just remember in your environment.rb file, you need to tell change_log gem
- what is your table name:
+ 4. *Turn ChangeLogs off in testing environment*
+You can globally turn it off for your testing.
+<pre><code># config/environment.rb
+ChangeLog.enabled = false if RAILS_ENV == 'test'
+</code></pre>
+
+ 5. *Database and table name*
+change_log gem can save changes into separate database from the main application.
+The database could be MySQL, SQLite or any other database that active record is happy to connect with.
+
+Here is an example of database.yml when using separate database for 'change_logs':
+<pre><code>change_logs:
+ adapter: mysql2
+ encoding: utf8
+ database: change_logs
+ username: username
+ password: ********
+ host: hostname
+ port: 3306
+</code></pre>
+
+And also you need to tell change_log gem to establish the connection.
+<pre><code># config/environment.rb
+ChangeLogs.establish_connection(:change_logs)
+</code></pre>
+
+Table name is also configurable. Instead of 'change_logs', choose your preferred table name and run the migration.
+Just remember in your environment.rb file, you need to tell change_log gem
+what is your table name:
<pre><code># config/environment.rb
ChangeLogs.set_table_name('hr_maintenances')
</code></pre>
+
h2. Wish List
Please email me if you have any enquiry.
@@ -136,4 +161,4 @@ h3. Author
Peter Zhang at NCS New Zealand.
Email: peterz@ncs.co.nz
-Copyright (c) 2011 Peter Zhang and NCS LTD, released under the MIT license
+Copyright (c) 2011 Peter Zhang and NCS LTD, released under the MIT license

0 comments on commit e13b4db

Please sign in to comment.