4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/pagelime/rails.rb', line 4
def initialize!
::Rails.logger.debug "PAGELIME CMS RAILS PLUGIN: initializing plugin"
app_path_relative = File.join('..', '..', 'app')
app_path = File.expand_path File.join(File.dirname(__FILE__), app_path_relative)
%w{ models controllers helpers }.each do |dir|
path = File.join(app_path, dir)
$LOAD_PATH << path
if ::Rails::VERSION::MAJOR == 2
ActiveSupport::Dependencies.load_paths << path
ActiveSupport::Dependencies.load_once_paths.delete(path)
elsif ::Rails::VERSION::MAJOR >= 3
ActiveSupport::Dependencies.autoload_paths << path
ActiveSupport::Dependencies.autoload_once_paths.delete(path)
end
end
require_relative 'rails/controller_extensions'
ActionController::Base.extend ControllerExtensions
require_relative File.join('.', app_path_relative, "helpers", "pagelime_helper")
ActionView::Base.send :include, PagelimeHelper
configure_pagelime!
end
|