lib/weasel.rb in weasel-0.1.0 vs lib/weasel.rb in weasel-0.2.0
- old
+ new
@@ -1,5 +1,32 @@
-require "weasel/version"
+require 'active_record'
+require 'active_support/concern'
+require 'weasel/concerns/auditable'
+require 'weasel/models/event'
+require 'weasel/workers/events_worker'
+require 'weasel/version'
+
module Weasel
- # Your code goes here...
+ def self.root
+ File.expand_path('../..', __FILE__)
+ end
+
+ class Configuration
+ attr_accessor :db_configuration
+ end
+
+ def self.config
+ @@config ||= Configuration.new
+ end
+
+ def self.configure
+ yield config
+
+ # Connect to current AR connection.
+ ActiveRecord::Base.establish_connection(config.db_configuration)
+
+ # Extend ActionController with the `audit_with_weasel` method.
+ ActionController::Base.extend(Weasel)
+ ActionController::Base.send(:include, Weasel::Auditable)
+ end
end