# encoding: utf-8 # all rails specific extensions require 'reporting/action_controller_extension' require 'reporting/helper' require 'google_data_source/helper' require 'google_data_source/test_helper' module GoogleDataSource class Railtie < Rails::Railtie initializer 'google_data_source.initialize', :after => :after_initialize do # register helper ActionView::Base.send :include, GoogleDataSource::DataSource::Helper ActionView::Base.send :include, GoogleDataSource::Reporting::Helper # Register controller extension #ActionController::Base.class_eval do # include GoogleDataSource::Reporting::ActionControllerExtension # alias_method_chain :render, :reporting #end # I18n I18n.load_path.unshift *Dir[File.join(File.dirname(__FILE__), '..', 'locale', '*.{rb,yml}')] # Register TemplateHandler # TODO set mime type to CSV / HTML according to the output format Mime::Type.register "application/json", :datasource ActionView::Template.register_template_handler(:datasource, GoogleDataSource::DataSource::TemplateHandler ) end end end