Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update new changes #1

Merged
merged 5 commits into from Dec 20, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 31 additions & 6 deletions README.textile
Expand Up @@ -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.

Expand All @@ -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