module Lithium::ActiveRecord
Public Class Methods
registered(app)
click to toggle source
# File lib/lithium/activerecord.rb, line 13 def self.registered app settings = Lithium::Base.settings file = "#{Dir.pwd}/config/database.yml" if File.exist?("#{Dir.pwd}/config/database.yml") path = File.join(root, file) if Pathname(file).relative? and root hash = YAML.load(File.read(file)) ::ActiveRecord::Base.establish_connection(hash[settings[:environment]]) app.before do app.before { ::ActiveRecord::Base.verify_active_connections! if ::ActiveRecord::Base.respond_to?(:verify_active_connections!) } app.after { ::ActiveRecord::Base.clear_active_connections! } end Dir[File.join(Dir.pwd, "models", "*.rb")].each do |file| require file end app.helpers self end