File tree 3 files changed +26
-4
lines changed
3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 1
1
master
2
2
------
3
3
4
+ * Support Rails 5 static file serving configuration. [ #499 ]
5
+
6
+ [ #499 ] : https://github.com/thoughtbot/ember-cli-rails/pull/499
7
+
4
8
0.8.1
5
9
-----
6
10
Original file line number Diff line number Diff line change @@ -29,9 +29,21 @@ def index_html
29
29
attr_reader :app
30
30
31
31
def rack_headers
32
- {
33
- "Cache-Control" => Rails . configuration . static_cache_control ,
34
- }
32
+ config = Rails . configuration
33
+
34
+ if config . respond_to? ( :public_file_server ) &&
35
+ config . public_file_server && config . public_file_server . headers
36
+ # Rails 5.
37
+ config . public_file_server . headers
38
+ elsif config . respond_to? ( :static_cache_control )
39
+ # Rails 4.2 and below.
40
+ {
41
+ "Cache-Control" => Rails . configuration . static_cache_control ,
42
+ }
43
+ else
44
+ # No specification.
45
+ { }
46
+ end
35
47
end
36
48
37
49
def check_for_error_and_raise!
Original file line number Diff line number Diff line change @@ -25,7 +25,13 @@ class Application < Rails::Application
25
25
# Print deprecation notices to the stderr.
26
26
config . active_support . deprecation = :stderr
27
27
28
- config . static_cache_control = CACHE_CONTROL_FIVE_MINUTES
28
+ if Rails . version >= "5"
29
+ config . public_file_server . headers = {
30
+ "Cache-Control" => CACHE_CONTROL_FIVE_MINUTES
31
+ }
32
+ else
33
+ config . static_cache_control = CACHE_CONTROL_FIVE_MINUTES
34
+ end
29
35
30
36
config . secret_token = "SECRET_TOKEN_IS_MIN_30_CHARS_LONG"
31
37
config . secret_key_base = "SECRET_KEY_BASE"
You can’t perform that action at this time.
0 commit comments