action_control 0.0.3 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/lib/action_control/controller_methods.rb +29 -15
  3. data/lib/action_control/railtie.rb +9 -0
  4. data/lib/action_control/version.rb +1 -1
  5. data/lib/action_control.rb +9 -1
  6. data/test/action_control_test.rb +2 -6
  7. data/test/dummy/bin/rails +1 -1
  8. data/test/dummy/bin/setup +17 -12
  9. data/test/dummy/bin/update +29 -0
  10. data/test/dummy/config/application.rb +4 -11
  11. data/test/dummy/config/boot.rb +2 -4
  12. data/test/dummy/config/cable.yml +9 -0
  13. data/test/dummy/config/environment.rb +1 -1
  14. data/test/dummy/config/environments/development.rb +27 -11
  15. data/test/dummy/config/environments/production.rb +27 -17
  16. data/test/dummy/config/environments/test.rb +6 -6
  17. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  18. data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
  19. data/test/dummy/config/initializers/new_framework_defaults.rb +23 -0
  20. data/test/dummy/config/initializers/wrap_parameters.rb +6 -1
  21. data/test/dummy/config/puma.rb +47 -0
  22. data/test/dummy/config/secrets.yml +3 -3
  23. data/test/dummy/config/spring.rb +6 -0
  24. data/test/dummy/log/test.log +233 -122
  25. data/test/dummy/test/controllers/welcome_controller_test.rb +4 -4
  26. data/test/dummy/tmp/cache/{sprockets/v3.0/IaQzQGXFQfBjkrxhDnuTvASIp7dzp5kCcg8w-Csu_IY.cache → assets/sprockets/v3.0/-G/-G9qYFwhiHbhodMBvDvMpdIxFovHFP1bLpPrsGOq324.cache} +0 -0
  27. data/test/dummy/tmp/cache/{sprockets/v3.0/Vb2Y-hLNYLDStluCCCj5SSZiiOLy2PO8hcPoz6kT75A.cache → assets/sprockets/v3.0/07/07q2yt_j79id6u6TOEw1YjriDt9IZpJxCnBrn2V_FNc.cache} +0 -0
  28. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1f/1fHr0FJubjihXvRK5L7TWOP093hXdTvGRONNWhXn5vI.cache +1 -0
  29. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  30. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7K/7KtZOE0fbzUUJ4Q4-8DpdC09Ox0tUWe74SD-n84okKE.cache +1 -0
  31. data/test/dummy/tmp/cache/assets/sprockets/v3.0/An/AnYDtwFwh9QeGGaiN5qchT25atRBJ5EiYGQVk9QwiIo.cache +1 -0
  32. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Cq/CqS8f-adc43tZVUYwbeYNlaAp68VAND9gSz75EJ_qIk.cache +3 -0
  33. data/test/dummy/tmp/cache/assets/sprockets/v3.0/EE/EEplIoXGshtrgJgFxcH1B6LgetWrS_RuhCYsTuqiO6s.cache +3 -0
  34. data/test/dummy/tmp/cache/{sprockets/v3.0/hQTnMC8F5eeLeiYssSZYLCGx79KLgUj18fUlyt7-HXs.cache → assets/sprockets/v3.0/Gz/GzyyxP9TL7lps8ZctXei-CejbUNVTEsuvMLPtt4PRIY.cache} +0 -0
  35. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Kk/KksV59eaFpSQWOe2mnto1HN5P7CkThhmyTgP3s0hyGQ.cache +1 -0
  36. data/test/dummy/tmp/cache/{sprockets/v3.0/cJMggEGypPzKwx81E8ea4CvAVxgpobH-q4uvErBv_kg.cache → assets/sprockets/v3.0/Kl/KlsT2FRfCN-lO4_0caoEBdtMNJnv6QhIo48df1Dxnnk.cache} +0 -0
  37. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  38. data/test/dummy/tmp/cache/{sprockets/v3.0/3JKkanNb216zALB8-924T4VDK6tJjkEFV-Bwgbj9B14.cache → assets/sprockets/v3.0/Qy/Qyt7GGoc2QyGSQirv_cuTaL-a6XxyuS86kCr76MnWdU.cache} +0 -0
  39. data/test/dummy/tmp/cache/assets/sprockets/v3.0/TF/TFa4aO9z80ukQQ6SeXE0BjKabh3opw4IUM8fN8VMk94.cache +0 -0
  40. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UP/UPpllWS-7a7xaBoR3C-XH-7MpEMy9YGJ2TtZhHoqcuk.cache +1 -0
  41. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UW/UWp5jfQrmg9x5LHX1wOeB-vt--xgMh1OGdj4Q0-2GDA.cache +0 -0
  42. data/test/dummy/tmp/cache/assets/sprockets/v3.0/XD/XD-8Me3zswjpqAuLiapCTkyU9UwnBhA-tqbZAphfOiI.cache +0 -0
  43. data/test/dummy/tmp/cache/{sprockets/v3.0/_VRRH7j3ZMxMxKW0Sg9TTTD5jlZh7oqWpZDsuNWCKYM.cache → assets/sprockets/v3.0/ca/caXlX6ClyXVbABLJPa02-8pJaShlP5KD93v5IhCoiUY.cache} +0 -0
  44. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ef/efKr38GeqdhQ0ODM__bWX8vwbySjF5HP-Q8NDnjhag8.cache +1 -0
  45. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  46. data/test/dummy/tmp/cache/{sprockets/v3.0/ROPBCmx5V50szmtJZQ1KcVsTqCQelEo0PTleLKnAFXs.cache → assets/sprockets/v3.0/iv/ivYovFUpnhuyfdV8L3REQCUuxThoDInPeXeqI8BeAHo.cache} +0 -0
  47. data/test/dummy/tmp/cache/{sprockets/v3.0/_D1t1IyVlDXU4ylfoagfIPFxF1mPsX8ak2RTaDQPUHg.cache → assets/sprockets/v3.0/ka/ka1ngBj-xy83DMBh3Wm3jzqFBVdHAXgIRIjUZvW_2hU.cache} +0 -0
  48. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  49. data/test/dummy/tmp/cache/{sprockets/v3.0/GFBoWLa7w-AyBQvckeZ0t9KOOannb3LF2nwW6y6YgF8.cache → assets/sprockets/v3.0/rJ/rJG7jjJN6asA3euclfMhCOz1FiDDEUVSmcz-b5_vLOQ.cache} +0 -0
  50. data/test/test_helper.rb +5 -5
  51. metadata +64 -65
  52. data/lib/action_control/action_controller/base.rb +0 -8
  53. data/test/dummy/log/development.log +0 -1193
  54. data/test/dummy/tmp/cache/sprockets/v3.0/0l0dzRDrwh8jbgwNcdqbI0eReG4vwBstqHkgAwNKVMI.cache +0 -0
  55. data/test/dummy/tmp/cache/sprockets/v3.0/3ggZ0W-Ys5SQS26u_NFEJe14n9nBRhdtzY3kcBWtpu8.cache +0 -1
  56. data/test/dummy/tmp/cache/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -2
  57. data/test/dummy/tmp/cache/sprockets/v3.0/9QE06Hoy-nitPf5xGEddC6zVi0kNWX_1DxmrNe0T2qM.cache +0 -1
  58. data/test/dummy/tmp/cache/sprockets/v3.0/CqS8f-adc43tZVUYwbeYNlaAp68VAND9gSz75EJ_qIk.cache +0 -2
  59. data/test/dummy/tmp/cache/sprockets/v3.0/CuqjeS-2eHHBlkxRvn8u1KzXJexpD4avFhe5otAxzKI.cache +0 -0
  60. data/test/dummy/tmp/cache/sprockets/v3.0/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +0 -2
  61. data/test/dummy/tmp/cache/sprockets/v3.0/E1OA9yJbW6lMNqFjch4O_Nm972yonIiNtGF4nEgeMgI.cache +0 -0
  62. data/test/dummy/tmp/cache/sprockets/v3.0/EEplIoXGshtrgJgFxcH1B6LgetWrS_RuhCYsTuqiO6s.cache +0 -2
  63. data/test/dummy/tmp/cache/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -2
  64. data/test/dummy/tmp/cache/sprockets/v3.0/UKGBReGXsgsCgfeO31yA5_k496KeznXmPBK5CVgIIqE.cache +0 -0
  65. data/test/dummy/tmp/cache/sprockets/v3.0/XrVJilAWIg8PWr-zSv8YW0Y-V-myv-Iht2JKCan_ym0.cache +0 -1
  66. data/test/dummy/tmp/cache/sprockets/v3.0/YfxKw2MPxJHBrxMEABBUhvLuuEDSKGrN06FK5Sh3uB4.cache +0 -1
  67. data/test/dummy/tmp/cache/sprockets/v3.0/YzLwjdol-fillzMShjbe2GgKGueXAc1nHbFTKSBo7-Q.cache +0 -1
  68. data/test/dummy/tmp/cache/sprockets/v3.0/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +0 -2
  69. data/test/dummy/tmp/cache/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -2
  70. data/test/dummy/tmp/cache/sprockets/v3.0/kRZh-Br9E6KK0oj2H8xkk_a4sOotGQ3V4x4i1dsN8l8.cache +0 -1
  71. data/test/dummy/tmp/cache/sprockets/v3.0/o6BRWItl0A8KUtdzj8CodRWOSdJBZEZoUwNZWkBIvKE.cache +0 -0
  72. data/test/dummy/tmp/cache/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -2
  73. data/test/dummy/tmp/cache/sprockets/v3.0/pNLwute95D3t-czgrFvKNRpZACiCXca-o3A806hAIBU.cache +0 -1
  74. data/test/dummy/tmp/cache/sprockets/v3.0/szxi6adMfobVBR3v1xjK3BuVOBK7TW6EONLC0uBTtIs.cache +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68b40a9dbfb819c3eafb2c73526966b776204054
4
- data.tar.gz: 7c036743a45484a4a014753d81149e4b63b5ac56
3
+ metadata.gz: 1920fc130b242ea4225c2022dfba0cf8216649b5
4
+ data.tar.gz: 731e4a2dec54612fa65755513b4589dfcb830668
5
5
  SHA512:
6
- metadata.gz: 04c8c27bc3725b0b7402fc02d59021d71fe7fbb2b4c7acd575eb119aa15db2c5ac062aa0749e9134120cd3c2b3232202c6bfc971c92c0d27dc4d692b47954515
7
- data.tar.gz: 0bd8dadee05df25cf141f41e379965da204e33de7c816be784739b9894f6d16e33073fb17acc31e0db467e1a610f7fb8e4f9c458573701aed65559a5bb9506b9
6
+ metadata.gz: 1fb2d31afd226c4b02f539219ee27123ebe32c1542d79328317ce4115f66fde56269f7895d41999d4020e7242af3d0b03b60b48d5c83d71d15eb92ea33494372
7
+ data.tar.gz: 1ec4566b649e43dd0b68821a039b1d942247be314042db5596ec6c29134b3f061385edf74db98d92a6b90d6142300ad6cb4af9a75a9f28439b8b81f7643fbe87
@@ -7,28 +7,42 @@ module ActionControl
7
7
  # True if the called action
8
8
  # is a only-read action.
9
9
  def read_action?
10
- action_name == "index" ||
11
- action_name == "show"
10
+ action_name == 'index' ||
11
+ action_name == 'show'
12
12
  end
13
13
 
14
14
  # @return [Boolean]
15
15
  # True if the called action
16
16
  # is a write action.
17
17
  def write_action?
18
- action_name == "new" ||
19
- action_name == "create" ||
20
- action_name == "edit" ||
21
- action_name == "update" ||
22
- action_name == "destroy"
18
+ action_name == 'new' ||
19
+ action_name == 'create' ||
20
+ action_name == 'edit' ||
21
+ action_name == 'update' ||
22
+ action_name == 'destroy'
23
23
  end
24
24
 
25
25
  # @return [Boolean]
26
26
  # True if the called action
27
27
  # is a change action.
28
28
  def change_action?
29
- action_name == "edit" ||
30
- action_name == "update" ||
31
- action_name == "destroy"
29
+ action_name == 'edit' ||
30
+ action_name == 'update' ||
31
+ action_name == 'destroy'
32
+ end
33
+
34
+ # @return [Boolean]
35
+ # True if the called action
36
+ # is the index action.
37
+ def index_action?
38
+ action_name == 'index'
39
+ end
40
+
41
+ # @return [Boolean]
42
+ # True if the called action
43
+ # is the show action.
44
+ def show_action?
45
+ action_name == 'show'
32
46
  end
33
47
 
34
48
  # @note
@@ -43,8 +57,8 @@ module ActionControl
43
57
  # True if the called action
44
58
  # is a create action.
45
59
  def create_action?
46
- action_name == "new" ||
47
- action_name == "create"
60
+ action_name == 'new' ||
61
+ action_name == 'create'
48
62
  end
49
63
 
50
64
  # @note
@@ -55,14 +69,14 @@ module ActionControl
55
69
  # True if the called action
56
70
  # is a update action.
57
71
  def update_action?
58
- action_name == "edit" ||
59
- action_name == "update"
72
+ action_name == 'edit' ||
73
+ action_name == 'update'
60
74
  end
61
75
 
62
76
  # @return [Boolean]
63
77
  # True if it's a destroy action.
64
78
  def destroy_action?
65
- action_name == "destroy"
79
+ action_name == 'destroy'
66
80
  end
67
81
 
68
82
  alias delete_action? destroy_action?
@@ -0,0 +1,9 @@
1
+ module ActionControl
2
+ class Railtie < Rails::Railtie
3
+ initializer 'action_control.insert_into_action_controller' do
4
+ ActiveSupport.on_load :action_controller do
5
+ ::ActionController::Base.include(ActionControl)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module ActionControl
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1"
3
3
  end
@@ -1,6 +1,5 @@
1
1
  require 'action_control/controller_methods'
2
2
  require 'action_control/errors'
3
- require 'action_control/action_controller/base'
4
3
 
5
4
  module ActionControl
6
5
  # Authorizes the user.
@@ -14,6 +13,15 @@ module ActionControl
14
13
  # This ensures that you actually do authorization in your controller.
15
14
  raise ActionControl::AuthorizationNotPerformedError unless defined?(authorized?)
16
15
 
16
+ # If the authorized? method does not return true
17
+ # it raises the ActionControl::NotAuthorizedError
18
+ #
19
+ # Use the .rescue_from method from ActionController::Base
20
+ # to recognize the exception raise and show the user
21
+ # an error message.
17
22
  raise ActionControl::NotAuthorizedError unless authorized? == true
18
23
  end
19
24
  end
25
+
26
+ # Load action control railtie
27
+ require 'action_control/railtie'
@@ -15,9 +15,7 @@ class ActionControlTest < ActiveSupport::TestCase
15
15
 
16
16
  test 'should raise `NotAuthorizedError` if #authorized? not returns true' do
17
17
  @authorizable.class_eval do
18
- define_method :authorized? do
19
- false
20
- end
18
+ def authorized?; false; end
21
19
  end
22
20
 
23
21
  assert_raise ActionControl::NotAuthorizedError do
@@ -27,9 +25,7 @@ class ActionControlTest < ActiveSupport::TestCase
27
25
 
28
26
  test 'should raise no exception if #authorized? returns true' do
29
27
  @authorizable.class_eval do
30
- define_method :authorized? do
31
- true
32
- end
28
+ def authorized?; true; end
33
29
  end
34
30
 
35
31
  assert_nothing_raised do
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
data/test/dummy/bin/setup CHANGED
@@ -1,29 +1,34 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
3
5
 
4
6
  # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
8
 
7
- Dir.chdir APP_ROOT do
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
8
14
  # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
15
+ # Add necessary setup steps to this file.
10
16
 
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
14
20
 
15
21
  # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
18
24
  # end
19
25
 
20
26
  puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
27
+ system! 'bin/rails db:setup'
22
28
 
23
29
  puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
30
+ system! 'bin/rails log:clear tmp:clear'
26
31
 
27
32
  puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
33
+ system! 'bin/rails restart'
29
34
  end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a way to update your development environment automatically.
15
+ # Add necessary update steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ puts "\n== Updating database =="
22
+ system! 'bin/rails db:migrate'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system! 'bin/rails log:clear tmp:clear'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system! 'bin/rails restart'
29
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require_relative 'boot'
2
2
 
3
3
  # Pick the frameworks you want:
4
4
  # require "active_record/railtie"
@@ -7,23 +7,16 @@ require "action_mailer/railtie"
7
7
  require "action_view/railtie"
8
8
  require "sprockets/railtie"
9
9
  require "rails/test_unit/railtie"
10
+ require "action_cable"
10
11
 
12
+ # Require the gems listed in Gemfile, including any gems
13
+ # you've limited to :test, :development, or :production.
11
14
  Bundler.require(*Rails.groups)
12
- require "action_control"
13
15
 
14
16
  module Dummy
15
17
  class Application < Rails::Application
16
18
  # Settings in config/environments/* take precedence over those specified here.
17
19
  # Application configuration should go into files in config/initializers
18
20
  # -- all .rb files in that directory are automatically loaded.
19
-
20
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
- # config.time_zone = 'Central Time (US & Canada)'
23
-
24
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
- # config.i18n.default_locale = :de
27
21
  end
28
22
  end
29
-
@@ -1,5 +1,3 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
2
 
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,9 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: redis://localhost:6379/1
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require_relative 'application'
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
@@ -9,30 +9,46 @@ Rails.application.configure do
9
9
  # Do not eager load code on boot.
10
10
  config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ if Rails.root.join('tmp/caching-dev.txt').exist?
17
+ config.action_controller.perform_caching = true
18
+
19
+ config.cache_store = :memory_store
20
+ config.public_file_server.headers = {
21
+ 'Cache-Control' => 'public, max-age=172800'
22
+ }
23
+ else
24
+ config.action_controller.perform_caching = false
25
+
26
+ config.cache_store = :null_store
27
+ end
15
28
 
16
29
  # Don't care if the mailer can't send.
17
30
  config.action_mailer.raise_delivery_errors = false
18
31
 
32
+ config.action_mailer.perform_caching = false
33
+
19
34
  # Print deprecation notices to the Rails logger.
20
35
  config.active_support.deprecation = :log
21
36
 
37
+ # Raise an error on page load if there are pending migrations.
38
+ # config.active_record.migration_error = :page_load
39
+
22
40
  # Debug mode disables concatenation and preprocessing of assets.
23
41
  # This option may cause significant delays in view rendering with a large
24
42
  # number of complex assets.
25
43
  config.assets.debug = true
26
44
 
27
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
28
- # yet still be able to expire them through the digest params.
29
- config.assets.digest = true
30
-
31
- # Adds additional error checking when serving assets at runtime.
32
- # Checks for improperly declared sprockets dependencies.
33
- # Raises helpful error messages.
34
- config.assets.raise_runtime_errors = true
45
+ # Suppress logger output for asset requests.
46
+ config.assets.quiet = true
35
47
 
36
48
  # Raises error for missing translations
37
49
  # config.action_view.raise_on_missing_translations = true
50
+
51
+ # Use an evented file watcher to asynchronously detect changes in source code,
52
+ # routes, locales, etc. This feature depends on the listen gem.
53
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
38
54
  end
@@ -14,15 +14,9 @@ Rails.application.configure do
14
14
  config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like
20
- # NGINX, varnish or squid.
21
- # config.action_dispatch.rack_cache = true
22
-
23
17
  # Disable serving static files from the `/public` folder by default since
24
18
  # Apache or NGINX already handles this.
25
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
19
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
20
 
27
21
  # Compress JavaScripts and CSS.
28
22
  config.assets.js_compressor = :uglifier
@@ -31,16 +25,20 @@ Rails.application.configure do
31
25
  # Do not fallback to assets pipeline if a precompiled asset is missed.
32
26
  config.assets.compile = false
33
27
 
34
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
- # yet still be able to expire them through the digest params.
36
- config.assets.digest = true
37
-
38
28
  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39
29
 
30
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
31
+ # config.action_controller.asset_host = 'http://assets.example.com'
32
+
40
33
  # Specifies the header that your server uses for sending files.
41
34
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
35
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43
36
 
37
+ # Mount Action Cable outside main process or domain
38
+ # config.action_cable.mount_path = nil
39
+ # config.action_cable.url = 'wss://example.com/cable'
40
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
41
+
44
42
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
43
  # config.force_ssl = true
46
44
 
@@ -49,16 +47,15 @@ Rails.application.configure do
49
47
  config.log_level = :debug
50
48
 
51
49
  # Prepend all log lines with the following tags.
52
- # config.log_tags = [ :subdomain, :uuid ]
53
-
54
- # Use a different logger for distributed setups.
55
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
50
+ config.log_tags = [ :request_id ]
56
51
 
57
52
  # Use a different cache store in production.
58
53
  # config.cache_store = :mem_cache_store
59
54
 
60
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
- # config.action_controller.asset_host = 'http://assets.example.com'
55
+ # Use a real queuing backend for Active Job (and separate queues per environment)
56
+ # config.active_job.queue_adapter = :resque
57
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
58
+ config.action_mailer.perform_caching = false
62
59
 
63
60
  # Ignore bad email addresses and do not raise email delivery errors.
64
61
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -73,4 +70,17 @@ Rails.application.configure do
73
70
 
74
71
  # Use default logging formatter so that PID and timestamp are not suppressed.
75
72
  config.log_formatter = ::Logger::Formatter.new
73
+
74
+ # Use a different logger for distributed setups.
75
+ # require 'syslog/logger'
76
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
77
+
78
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
79
+ logger = ActiveSupport::Logger.new(STDOUT)
80
+ logger.formatter = config.log_formatter
81
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
82
+ end
83
+
84
+ # Do not dump schema after migrations.
85
+ # config.active_record.dump_schema_after_migration = false
76
86
  end
@@ -12,9 +12,11 @@ Rails.application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static file server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => 'public, max-age=3600'
19
+ }
18
20
 
19
21
  # Show full error reports and disable caching.
20
22
  config.consider_all_requests_local = true
@@ -25,15 +27,13 @@ Rails.application.configure do
25
27
 
26
28
  # Disable request forgery protection in test environment.
27
29
  config.action_controller.allow_forgery_protection = false
30
+ config.action_mailer.perform_caching = false
28
31
 
29
32
  # Tell Action Mailer not to deliver emails to the real world.
30
33
  # The :test delivery method accumulates sent emails in the
31
34
  # ActionMailer::Base.deliveries array.
32
35
  config.action_mailer.delivery_method = :test
33
36
 
34
- # Randomize the order test cases are executed.
35
- config.active_support.test_order = :random
36
-
37
37
  # Print deprecation notices to the stderr.
38
38
  config.active_support.deprecation = :stderr
39
39