Search code examples
ruby-on-rails-3initializationruport

how to config ruport in the environment.rb


i have installed ruport gem along with its ruport-utils packages and act_as_reportable gem too.... e

"Ash::Application.initialize!

Rails::Initializer.run do |config| config.after_initialize do require "ruport" end end" when executing this in the environment.rb file... it shows this "

c:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/application.rb:63:in `inherited': You cannot have more than one Rails::Application (RuntimeError)" what am i doing wrong.... can somebody help me with properly configuration method of ruport.


Solution

  • The most reliable way to do so, and be sure that Ruport is loaded at the proper time, is to add the code to require Ruport to a config.after_initialize block. The relevant section of the configuration file is shown below.

    Rails::Initializer.run do |config|
        config.after_initialize do 
          require "ruport" 
        end
    end