Permalink
Browse files

- Working to make Cockpit::Settings accessible in initializers

  • Loading branch information...
1 parent 0513976 commit 76564a8fb357995dc58ea43177642f554357516a @treydock committed Apr 23, 2012
Showing with 18 additions and 5 deletions.
  1. +18 −5 lib/cockpit.rb
View
@@ -1,17 +1,30 @@
require 'rubygems'
require 'defined-by'
+require 'cockpit/core/include'
+#require 'cockpit/core/scope'
+#require 'cockpit/core/store'
+#require 'cockpit/core/helpers'
+#require 'cockpit/core/global'
+#require 'cockpit/stores/active_record'
+require 'cockpit/core/settings'
+
module Cockpit
+
autoload :Scope, 'cockpit/core/scope'
autoload :Settings, 'cockpit/core/settings'
autoload :Store, 'cockpit/core/store'
autoload :ViewHelpers, 'cockpit/core/helpers'
-end
-
-require 'cockpit/core/include'
-
-ActiveRecord::Base.send(:include, Cockpit) if defined?(ActiveRecord::Base)
+ module Rails
+ class Railtie < ::Rails::Railtie
+ initializer 'cockpit.ar_extensions' do |app|
+ ActiveRecord::Base.send(:include, Cockpit) if defined?(ActiveRecord::Base)
+ end
+ end
+ end
+end
+
def Settings(*args, &block)
Cockpit::Settings.define!(*args, &block)
end

0 comments on commit 76564a8

Please sign in to comment.