impressionist-cody 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +25 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.rubocop.yml +27 -0
- data/.rubocop_todo.yml +660 -0
- data/CHANGELOG.rdoc +96 -0
- data/Gemfile +22 -0
- data/LICENSE.txt +20 -0
- data/README.md +265 -0
- data/Rakefile +20 -0
- data/UPGRADE_GUIDE.md +13 -0
- data/app/assets/config/manifest.js +3 -0
- data/app/controllers/impressionist_controller.rb +166 -0
- data/app/models/impression.rb +2 -0
- data/app/models/impressionist/bots.rb +1468 -0
- data/app/models/impressionist/impressionable.rb +62 -0
- data/impressionist.gemspec +30 -0
- data/lib/generators/active_record/impressionist_generator.rb +22 -0
- data/lib/generators/active_record/templates/create_impressions_table.rb.erb +32 -0
- data/lib/generators/impressionist_generator.rb +13 -0
- data/lib/generators/mongo_mapper/impressionist_generator.rb +8 -0
- data/lib/generators/mongoid/impressionist_generator.rb +8 -0
- data/lib/generators/templates/impression.rb.erb +8 -0
- data/lib/impressionist/bots.rb +21 -0
- data/lib/impressionist/controllers/mongoid/impressionist_controller.rb +10 -0
- data/lib/impressionist/counter_cache.rb +76 -0
- data/lib/impressionist/engine.rb +45 -0
- data/lib/impressionist/is_impressionable.rb +23 -0
- data/lib/impressionist/load.rb +11 -0
- data/lib/impressionist/models/active_record/impression.rb +14 -0
- data/lib/impressionist/models/active_record/impressionist/impressionable.rb +12 -0
- data/lib/impressionist/models/mongo_mapper/impression.rb +18 -0
- data/lib/impressionist/models/mongo_mapper/impressionist/impressionable.rb +21 -0
- data/lib/impressionist/models/mongoid/impression.rb +26 -0
- data/lib/impressionist/models/mongoid/impressionist/impressionable.rb +28 -0
- data/lib/impressionist/rails_toggle.rb +26 -0
- data/lib/impressionist/setup_association.rb +53 -0
- data/lib/impressionist/update_counters.rb +77 -0
- data/lib/impressionist/version.rb +3 -0
- data/lib/impressionist.rb +12 -0
- data/logo.png +0 -0
- data/spec/controllers/articles_controller_spec.rb +113 -0
- data/spec/controllers/dummy_controller_spec.rb +13 -0
- data/spec/controllers/impressionist_uniqueness_spec.rb +463 -0
- data/spec/controllers/posts_controller_spec.rb +36 -0
- data/spec/controllers/widgets_controller_spec.rb +103 -0
- data/spec/counter_caching_spec.rb +49 -0
- data/spec/dummy/.ruby-version +1 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +1 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/controllers/articles_controller.rb +22 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/dummy_controller.rb +6 -0
- data/spec/dummy/app/controllers/posts_controller.rb +23 -0
- data/spec/dummy/app/controllers/profiles_controller.rb +14 -0
- data/spec/dummy/app/controllers/widgets_controller.rb +12 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/javascript/packs/application.js +15 -0
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/article.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/dummy.rb +7 -0
- data/spec/dummy/app/models/post.rb +3 -0
- data/spec/dummy/app/models/profile.rb +6 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/models/widget.rb +3 -0
- data/spec/dummy/app/views/articles/index.html.erb +1 -0
- data/spec/dummy/app/views/articles/show.html.erb +1 -0
- data/spec/dummy/app/views/dummy/index.html.erb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/app/views/posts/edit.html.erb +0 -0
- data/spec/dummy/app/views/posts/index.html.erb +0 -0
- data/spec/dummy/app/views/posts/show.html.erb +0 -0
- data/spec/dummy/app/views/profiles/show.html.erb +3 -0
- data/spec/dummy/app/views/widgets/index.html.erb +0 -0
- data/spec/dummy/app/views/widgets/new.html.erb +0 -0
- data/spec/dummy/app/views/widgets/show.html.erb +0 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +33 -0
- data/spec/dummy/config/application.rb +20 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +62 -0
- data/spec/dummy/config/environments/production.rb +112 -0
- data/spec/dummy/config/environments/test.rb +49 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +12 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/impression.rb +8 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +38 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/config.ru2 +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20110201153144_create_articles.rb +13 -0
- data/spec/dummy/db/migrate/20110210205028_create_posts.rb +13 -0
- data/spec/dummy/db/migrate/20111127184039_create_widgets.rb +15 -0
- data/spec/dummy/db/migrate/20150207135825_create_profiles.rb +10 -0
- data/spec/dummy/db/migrate/20150207140310_create_friendly_id_slugs.rb +18 -0
- data/spec/dummy/db/migrate/20200720143817_create_impressions_table.rb +32 -0
- data/spec/dummy/db/schema.rb +77 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/log/development.log +129 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/storage/.keep +0 -0
- data/spec/fixtures/articles.yml +3 -0
- data/spec/fixtures/impressions.yml +43 -0
- data/spec/fixtures/posts.yml +3 -0
- data/spec/fixtures/profiles.yml +4 -0
- data/spec/fixtures/widgets.yml +4 -0
- data/spec/initializers_spec.rb +21 -0
- data/spec/models/bots_spec.rb +25 -0
- data/spec/models/impression_spec.rb +66 -0
- data/spec/rails_generators/rails_generators_spec.rb +23 -0
- data/spec/rails_helper.rb +11 -0
- data/spec/rails_toggle_spec.rb +31 -0
- data/spec/setup_association_spec.rb +48 -0
- data/spec/spec_helper.rb +43 -0
- data/upgrade_migrations/version_0_3_0.rb +27 -0
- data/upgrade_migrations/version_0_4_0.rb +9 -0
- data/upgrade_migrations/version_1_5_2.rb +12 -0
- metadata +302 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WidgetsController do
|
4
|
+
before do
|
5
|
+
@widget = Widget.find(1)
|
6
|
+
allow(Widget).to receive(:find).and_return(@widget)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "logs impression at the per action level" do
|
10
|
+
get :show, params: { id: 1 }
|
11
|
+
expect(Impression.all.size).to eq 12
|
12
|
+
|
13
|
+
get :index
|
14
|
+
|
15
|
+
expect(Impression.all.size).to eq 13
|
16
|
+
|
17
|
+
get :new
|
18
|
+
|
19
|
+
expect(Impression.all.size).to eq 13
|
20
|
+
end
|
21
|
+
|
22
|
+
it "does not log impression when user-agent is in wildcard list" do
|
23
|
+
request.env['HTTP_USER_AGENT'] = 'somebot'
|
24
|
+
|
25
|
+
get :show, params: { id: 1 }
|
26
|
+
expect(Impression.all.size).to eq 11
|
27
|
+
end
|
28
|
+
|
29
|
+
it "does not log impression when user-agent is in the bot list" do
|
30
|
+
request.env['HTTP_USER_AGENT'] = 'Acoon Robot v1.50.001'
|
31
|
+
|
32
|
+
get :show, params: { id: 1 }
|
33
|
+
expect(Impression.all.size).to eq 11
|
34
|
+
end
|
35
|
+
|
36
|
+
context "impressionist unique options" do
|
37
|
+
it "logs unique impressions at the per action level" do
|
38
|
+
get :show, params: { id: 1 }
|
39
|
+
expect(Impression.all.size).to eq 12
|
40
|
+
get :show, params: { id: 2 }
|
41
|
+
expect(Impression.all.size).to eq 13
|
42
|
+
get :show, params: { id: 2 }
|
43
|
+
expect(Impression.all.size).to eq 13
|
44
|
+
get :index
|
45
|
+
expect(Impression.all.size).to eq 14
|
46
|
+
end
|
47
|
+
|
48
|
+
it "logs unique impressions only once per id" do
|
49
|
+
get :show, params: { id: 1 }
|
50
|
+
expect(Impression.all.size).to eq 12
|
51
|
+
get :show, params: { id: 2 }
|
52
|
+
expect(Impression.all.size).to eq 13
|
53
|
+
|
54
|
+
get :show, params: { id: 2 }
|
55
|
+
expect(Impression.all.size).to eq 13
|
56
|
+
|
57
|
+
get :index
|
58
|
+
expect(Impression.all.size).to eq 14
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "Impresionist unique params options" do
|
63
|
+
it "logs unique impressions at the per action and params level" do
|
64
|
+
get :show, params: { id: 1 }
|
65
|
+
expect(Impression.all.size).to eq 12
|
66
|
+
|
67
|
+
get :show, params: { id: 2, checked: true }
|
68
|
+
expect(Impression.all.size).to eq 13
|
69
|
+
|
70
|
+
get :show, params: { id: 2, checked: false }
|
71
|
+
expect(Impression.all.size).to eq 14
|
72
|
+
|
73
|
+
get :index
|
74
|
+
expect(Impression.all.size).to eq 15
|
75
|
+
end
|
76
|
+
|
77
|
+
it "does not log impression for same params and same id" do
|
78
|
+
get :show, params: { id: 1 }
|
79
|
+
expect(Impression.all.size).to eq 12
|
80
|
+
|
81
|
+
get :show, params: { id: 1 }
|
82
|
+
expect(Impression.all.size).to eq 12
|
83
|
+
|
84
|
+
get :show, params: { id: 1, checked: true }
|
85
|
+
expect(Impression.all.size).to eq 13
|
86
|
+
|
87
|
+
get :show, params: { id: 1, checked: false }
|
88
|
+
expect(Impression.all.size).to eq 14
|
89
|
+
|
90
|
+
get :show, params: { id: 1, checked: true }
|
91
|
+
expect(Impression.all.size).to eq 14
|
92
|
+
|
93
|
+
get :show, params: { id: 1, checked: false }
|
94
|
+
expect(Impression.all.size).to eq 14
|
95
|
+
|
96
|
+
get :show, params: { id: 1 }
|
97
|
+
expect(Impression.all.size).to eq 14
|
98
|
+
|
99
|
+
get :show, params: { id: 2 }
|
100
|
+
expect(Impression.all.size).to eq 15
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Impression do
|
4
|
+
fixtures :widgets
|
5
|
+
|
6
|
+
let(:widget) { Widget.find(1) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
described_class.destroy_all
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "self#impressionist_counter_caching?" do
|
13
|
+
it "knows when counter caching is enabled" do
|
14
|
+
expect(Widget).to be_impressionist_counter_caching
|
15
|
+
end
|
16
|
+
|
17
|
+
it "knows when counter caching is disabled" do
|
18
|
+
expect(Article).not_to be_impressionist_counter_caching
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "self#counter_caching?" do
|
23
|
+
it "knows when counter caching is enabled" do
|
24
|
+
allow(ActiveSupport::Deprecation).to receive(:warn)
|
25
|
+
expect(Widget).to be_counter_caching
|
26
|
+
end
|
27
|
+
|
28
|
+
it "knows when counter caching is disabled" do
|
29
|
+
allow(ActiveSupport::Deprecation).to receive(:warn)
|
30
|
+
expect(Article).not_to be_counter_caching
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#update_impressionist_counter_cache" do
|
35
|
+
it "updates the counter cache column to reflect the correct number of impressions" do
|
36
|
+
expect do
|
37
|
+
widget.impressions.create(:request_hash => 'abcd1234')
|
38
|
+
widget.reload
|
39
|
+
end.to change(widget, :impressions_count).from(0).to(1)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "does not update the timestamp on the impressable" do
|
43
|
+
expect do
|
44
|
+
widget.impressions.create(:request_hash => 'abcd1234')
|
45
|
+
widget.reload
|
46
|
+
end.not_to change(widget, :updated_at)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
2.7.1
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
//= link application.css
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class ArticlesController < ApplicationController
|
2
|
+
if Rails::VERSION::MAJOR >= 5
|
3
|
+
before_action :test_current_user_var
|
4
|
+
else
|
5
|
+
before_filter :test_current_user_var
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_current_user_var
|
9
|
+
if session[:user_id]
|
10
|
+
@current_user = User.new
|
11
|
+
@current_user.id = session[:user_id]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def index
|
16
|
+
impressionist(Article.first,"this is a test article impression")
|
17
|
+
end
|
18
|
+
|
19
|
+
def show
|
20
|
+
impressionist(Article.first)
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
helper_method :current_user
|
3
|
+
impressionist
|
4
|
+
def index
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def edit
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def current_user
|
17
|
+
if session[:user_id]
|
18
|
+
user = User.new
|
19
|
+
user.id = session[:user_id]
|
20
|
+
@current_user ||= user
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require activestorage
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# We don't really care about this model. It's just being used to test the uniqueness controller
|
2
|
+
# specs. Nevertheless, we need a model because the counter caching functionality expects it.
|
3
|
+
#
|
4
|
+
class Dummy < ActiveRecord::Base
|
5
|
+
self.abstract_class = true # doesn't need to be backed by an actual table
|
6
|
+
is_impressionable
|
7
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%=@impressionist_hash==nil%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%=link_to "Same Page", article_url(Article.first)%>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
6
|
+
|
7
|
+
def system!(*args)
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to setup or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
19
|
+
|
20
|
+
# puts "\n== Copying sample files =="
|
21
|
+
# unless File.exist?('config/database.yml')
|
22
|
+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
23
|
+
# end
|
24
|
+
|
25
|
+
puts "\n== Preparing database =="
|
26
|
+
system! 'bin/rails db:prepare'
|
27
|
+
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
29
|
+
system! 'bin/rails log:clear tmp:clear'
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system! 'bin/rails restart'
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
# FIXME
|
7
|
+
require "impressionist"
|
8
|
+
|
9
|
+
module Dummy
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Initialize configuration defaults for originally generated Rails version.
|
12
|
+
config.load_defaults 6.0
|
13
|
+
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration can go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
17
|
+
# the framework and any gems in your application.
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
# Run rails dev:cache to toggle caching.
|
17
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
18
|
+
config.action_controller.perform_caching = true
|
19
|
+
config.action_controller.enable_fragment_cache_logging = true
|
20
|
+
|
21
|
+
config.cache_store = :memory_store
|
22
|
+
config.public_file_server.headers = {
|
23
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
24
|
+
}
|
25
|
+
else
|
26
|
+
config.action_controller.perform_caching = false
|
27
|
+
|
28
|
+
config.cache_store = :null_store
|
29
|
+
end
|
30
|
+
|
31
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
32
|
+
config.active_storage.service = :local
|
33
|
+
|
34
|
+
# Don't care if the mailer can't send.
|
35
|
+
config.action_mailer.raise_delivery_errors = false
|
36
|
+
|
37
|
+
config.action_mailer.perform_caching = false
|
38
|
+
|
39
|
+
# Print deprecation notices to the Rails logger.
|
40
|
+
config.active_support.deprecation = :log
|
41
|
+
|
42
|
+
# Raise an error on page load if there are pending migrations.
|
43
|
+
config.active_record.migration_error = :page_load
|
44
|
+
|
45
|
+
# Highlight code that triggered database queries in logs.
|
46
|
+
config.active_record.verbose_query_logs = true
|
47
|
+
|
48
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
49
|
+
# This option may cause significant delays in view rendering with a large
|
50
|
+
# number of complex assets.
|
51
|
+
config.assets.debug = true
|
52
|
+
|
53
|
+
# Suppress logger output for asset requests.
|
54
|
+
config.assets.quiet = true
|
55
|
+
|
56
|
+
# Raises error for missing translations.
|
57
|
+
# config.action_view.raise_on_missing_translations = true
|
58
|
+
|
59
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
60
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
61
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
62
|
+
end
|