2010-08-24 01:27:17 +02:00
|
|
|
require "rails"
|
|
|
|
require "active_model/railtie"
|
|
|
|
|
2011-04-30 00:34:12 +02:00
|
|
|
module CouchRest
|
2010-08-24 01:27:17 +02:00
|
|
|
# = Active Record Railtie
|
2011-04-30 00:34:12 +02:00
|
|
|
class ModelRailtie < Rails::Railtie
|
2010-11-19 01:03:40 +01:00
|
|
|
config.generators.orm :couchrest_model
|
2010-08-24 01:27:17 +02:00
|
|
|
config.generators.test_framework :test_unit, :fixture => false
|
2011-04-30 00:34:12 +02:00
|
|
|
|
|
|
|
initializer "couchrest_model.configure_default_connection" do
|
|
|
|
CouchRest::Model::Base.configure do |conf|
|
|
|
|
conf.environment = Rails.env
|
|
|
|
conf.connection_config_file = File.join(Rails.root, 'config', 'couchdb.yml')
|
|
|
|
conf.connection[:prefix] =
|
|
|
|
Rails.application.class.to_s.underscore.gsub(/\/.*/, '')
|
|
|
|
end
|
|
|
|
end
|
2010-08-24 01:27:17 +02:00
|
|
|
end
|
2011-04-30 00:34:12 +02:00
|
|
|
|
2010-08-24 01:27:17 +02:00
|
|
|
end
|
2011-04-30 00:34:12 +02:00
|
|
|
|