Question

I want to use this rack middleware in my rails app, followed every solutions on another SO post but still no luck, keep on getting uninitialized constant error.

So, what's the precise location to put the rack middleware file and include the config.middleware.use in Rails 3.2.3? Thanks.

Was it helpful?

Solution

I suspect you're getting this error because you're not requiring the file anywhere. There's two ways you can get around this.

The first is to actually require the file that defines your constant, in a place like config/application.rb and before the constant is referenced.

The second is to add the lib directory to the autoload_paths for your application (which I explain here) and so that when this constant is referenced, the matching file wil be loaded.

Your choice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top