lib/engine.rb in crawlable-0.0.1.7 vs lib/engine.rb in crawlable-0.0.1.8
- old
+ new
@@ -1,9 +1,28 @@
module Crawlable
class Engine < Rails::Engine
initializer "authlogic_connect.authentication_hook" do |app|
app.middleware.use Crawlable::Rack
+ add_helpers Crawlable::Sitemap, Crawlable::Feed
+ end
+
+ def add_helpers(*clazzes)
+ clazzes.each do |clazz|
+ clazz.class_eval do
+ include ApplicationHelper
+
+ if defined?(::Rails)
+ if ActionPack::VERSION::MAJOR == 3
+ include ::Rails.application.routes.url_helpers
+ else
+ require 'action_controller'
+ include ActionController::UrlWriter
+ end
+ default_url_options[:host] = 'localhost:3000'
+ end
+ end
+ end
end
end
end