Skip to content

Model DSL: Development Issues

adriancuadros edited this page Oct 10, 2012 · 1 revision

Innsights sets callbacks to ActiveRecord models when adding the reports, but sometimes this callbacks will not persist during requests.

This issue might be caused by your development environment configurations that reload the model file during each request.

To fix this you can force Rails to reevaluate the Innsights.setup before each request.

Rails.configuration.to_prepare do
  Innsights.setup do
    # ...
  end
end

NOTE: This fix will not affect production performance, it only reevaluated the block multiple times in development and test environments

See Rails documentation for Rails.configuraion.to_prepare details.

Clone this wiki locally