Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/rocket_pants/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ class Railtie < Rails::Railtie

initializer "rocket_pants.setup_caching" do |app|
if RocketPants.caching_enabled?
app.middleware.insert 'Rack::Runtime', RocketPants::CacheMiddleware
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to maintain compatibility with rails 4, can you add a check for determining the rails version and use the old way for that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change it to be:
if Rails::VERSION::MAJOR >= 5

run_time_middleware = if Rails::VERSION::MAJOR >= 5
Rack::Runtime
else
"Rack::Runtime"
end
app.middleware.insert run_time_middleware, RocketPants::CacheMiddleware
end
end

Expand Down