lib/gmaps4rails.rb in gmaps4rails-1.3.2 vs lib/gmaps4rails.rb in gmaps4rails-1.4.0
- old
+ new
@@ -1,24 +1,29 @@
if defined?(Rails) && Rails::VERSION::MAJOR == 3
module Gmaps4rails
require 'rails'
require 'gmaps4rails/base'
- require 'gmaps4rails/acts_as_gmappable'
- require 'gmaps4rails/extensions/array'
- require 'gmaps4rails/extensions/hash'
- require 'gmaps4rails/helper/gmaps4rails_helper'
class Engine < Rails::Engine
+
initializer "gmaps4rails view helpers" do |app|
ActionView::Base.send :include, Gmaps4railsHelper
end
+
initializer "add asset directories to pipeline" do |app|
if Rails::VERSION::MINOR >= 1
app.config.assets.paths << "#{root}/public/stylesheets"
else
app.middleware.use ::ActionDispatch::Static, "#{root}/public"
end
end
+
+ initializer "include acts_as_gmappable within ActiveRecord" do
+ if defined?(::ActiveRecord::Base)
+ ActiveRecord::Base.send(:include, Gmaps4rails::ActsAsGmappable::InstanceMethods)
+ ActiveRecord::Base.send(:extend, Gmaps4rails::ActsAsGmappable::ClassMethods)
+ end
+ end
+
end
-
end
end
\ No newline at end of file