paper_trail_scrapbook 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +21 -0
  3. data/.rspec +5 -0
  4. data/.rubocop.yml +8 -0
  5. data/.ruby-gemset +1 -0
  6. data/Changelog.md +0 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +141 -0
  9. data/LICENSE.md +21 -0
  10. data/README.md +77 -0
  11. data/Rakefile +24 -0
  12. data/circle.yml +10 -0
  13. data/lib/paper_trail_scrapbook/changes.rb +89 -0
  14. data/lib/paper_trail_scrapbook/chapter.rb +49 -0
  15. data/lib/paper_trail_scrapbook/config.rb +13 -0
  16. data/lib/paper_trail_scrapbook/life_history.rb +17 -0
  17. data/lib/paper_trail_scrapbook/version.rb +4 -0
  18. data/lib/paper_trail_scrapbook.rb +51 -0
  19. data/paper_trail_scrapbook.gemspec +38 -0
  20. data/spec/dummy_app/Rakefile +7 -0
  21. data/spec/dummy_app/app/models/animal.rb +4 -0
  22. data/spec/dummy_app/app/models/article.rb +24 -0
  23. data/spec/dummy_app/app/models/authorship.rb +5 -0
  24. data/spec/dummy_app/app/models/bar_habtm.rb +4 -0
  25. data/spec/dummy_app/app/models/book.rb +9 -0
  26. data/spec/dummy_app/app/models/boolit.rb +4 -0
  27. data/spec/dummy_app/app/models/callback_modifier.rb +45 -0
  28. data/spec/dummy_app/app/models/car.rb +3 -0
  29. data/spec/dummy_app/app/models/cat.rb +2 -0
  30. data/spec/dummy_app/app/models/chapter.rb +9 -0
  31. data/spec/dummy_app/app/models/citation.rb +5 -0
  32. data/spec/dummy_app/app/models/custom_primary_key_record.rb +15 -0
  33. data/spec/dummy_app/app/models/customer.rb +4 -0
  34. data/spec/dummy_app/app/models/document.rb +6 -0
  35. data/spec/dummy_app/app/models/dog.rb +2 -0
  36. data/spec/dummy_app/app/models/editor.rb +4 -0
  37. data/spec/dummy_app/app/models/editorship.rb +5 -0
  38. data/spec/dummy_app/app/models/elephant.rb +3 -0
  39. data/spec/dummy_app/app/models/fluxor.rb +3 -0
  40. data/spec/dummy_app/app/models/foo_habtm.rb +5 -0
  41. data/spec/dummy_app/app/models/foo_widget.rb +2 -0
  42. data/spec/dummy_app/app/models/fruit.rb +5 -0
  43. data/spec/dummy_app/app/models/gadget.rb +3 -0
  44. data/spec/dummy_app/app/models/kitchen/banana.rb +5 -0
  45. data/spec/dummy_app/app/models/legacy_widget.rb +3 -0
  46. data/spec/dummy_app/app/models/line_item.rb +4 -0
  47. data/spec/dummy_app/app/models/not_on_update.rb +4 -0
  48. data/spec/dummy_app/app/models/on/create.rb +6 -0
  49. data/spec/dummy_app/app/models/on/destroy.rb +6 -0
  50. data/spec/dummy_app/app/models/on/empty_array.rb +6 -0
  51. data/spec/dummy_app/app/models/on/update.rb +6 -0
  52. data/spec/dummy_app/app/models/order.rb +5 -0
  53. data/spec/dummy_app/app/models/paragraph.rb +5 -0
  54. data/spec/dummy_app/app/models/person.rb +39 -0
  55. data/spec/dummy_app/app/models/post.rb +3 -0
  56. data/spec/dummy_app/app/models/post_with_status.rb +7 -0
  57. data/spec/dummy_app/app/models/quotation.rb +5 -0
  58. data/spec/dummy_app/app/models/section.rb +6 -0
  59. data/spec/dummy_app/app/models/skipper.rb +3 -0
  60. data/spec/dummy_app/app/models/song.rb +37 -0
  61. data/spec/dummy_app/app/models/thing.rb +3 -0
  62. data/spec/dummy_app/app/models/translation.rb +6 -0
  63. data/spec/dummy_app/app/models/truck.rb +4 -0
  64. data/spec/dummy_app/app/models/vehicle.rb +4 -0
  65. data/spec/dummy_app/app/models/whatchamajigger.rb +4 -0
  66. data/spec/dummy_app/app/models/widget.rb +8 -0
  67. data/spec/dummy_app/app/models/wotsit.rb +8 -0
  68. data/spec/dummy_app/app/versions/custom_primary_key_record_version.rb +3 -0
  69. data/spec/dummy_app/app/versions/joined_version.rb +6 -0
  70. data/spec/dummy_app/app/versions/json_version.rb +3 -0
  71. data/spec/dummy_app/app/versions/kitchen/banana_version.rb +5 -0
  72. data/spec/dummy_app/app/versions/post_version.rb +3 -0
  73. data/spec/dummy_app/config/application.rb +37 -0
  74. data/spec/dummy_app/config/boot.rb +24 -0
  75. data/spec/dummy_app/config/database.sqlite.yml +15 -0
  76. data/spec/dummy_app/config/database.yml +15 -0
  77. data/spec/dummy_app/config/environment.rb +5 -0
  78. data/spec/dummy_app/config/environments/development.rb +36 -0
  79. data/spec/dummy_app/config/environments/production.rb +74 -0
  80. data/spec/dummy_app/config/environments/test.rb +46 -0
  81. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +9 -0
  82. data/spec/dummy_app/config/initializers/inflections.rb +10 -0
  83. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  84. data/spec/dummy_app/config/initializers/paper_trail.rb +1 -0
  85. data/spec/dummy_app/config/initializers/secret_token.rb +9 -0
  86. data/spec/dummy_app/config/initializers/session_store.rb +8 -0
  87. data/spec/dummy_app/config/locales/en.yml +5 -0
  88. data/spec/dummy_app/config/routes.rb +4 -0
  89. data/spec/dummy_app/config.ru +4 -0
  90. data/spec/dummy_app/db/migrate/20110208155312_set_up_test_tables.rb +344 -0
  91. data/spec/dummy_app/db/schema.rb +296 -0
  92. data/spec/dummy_app/db/test.sqlite3 +0 -0
  93. data/spec/paper_trail_scrapbook/changes_spec.rb +6 -0
  94. data/spec/paper_trail_scrapbook/chapter_spec.rb +6 -0
  95. data/spec/paper_trail_scrapbook/config_spec.rb +17 -0
  96. data/spec/paper_trail_scrapbook/life_history_spec.rb +6 -0
  97. data/spec/paper_trail_scrapbook/version_spec.rb +6 -0
  98. data/spec/paper_trail_scrapbook_spec.rb +4 -0
  99. data/spec/spec_helper.rb +73 -0
  100. metadata +363 -0
@@ -0,0 +1,45 @@
1
+ class CallbackModifier < ActiveRecord::Base
2
+ has_paper_trail on: []
3
+
4
+ def test_destroy
5
+ transaction do
6
+ run_callbacks(:destroy) do
7
+ self.deleted = true
8
+ save!
9
+ end
10
+ end
11
+ end
12
+
13
+ def flagged_deleted?
14
+ deleted?
15
+ end
16
+ end
17
+
18
+ class BeforeDestroyModifier < CallbackModifier
19
+ has_paper_trail on: []
20
+ paper_trail.on_destroy :before
21
+ end
22
+
23
+ class AfterDestroyModifier < CallbackModifier
24
+ has_paper_trail on: []
25
+ paper_trail.on_destroy :after
26
+ end
27
+
28
+ class NoArgDestroyModifier < CallbackModifier
29
+ has_paper_trail on: []
30
+ paper_trail.on_destroy
31
+ end
32
+
33
+ class UpdateModifier < CallbackModifier
34
+ has_paper_trail on: []
35
+ paper_trail.on_update
36
+ end
37
+
38
+ class CreateModifier < CallbackModifier
39
+ has_paper_trail on: []
40
+ paper_trail.on_create
41
+ end
42
+
43
+ class DefaultModifier < CallbackModifier
44
+ has_paper_trail
45
+ end
@@ -0,0 +1,3 @@
1
+ class Car < Vehicle
2
+ has_paper_trail
3
+ end
@@ -0,0 +1,2 @@
1
+ class Cat < Animal
2
+ end
@@ -0,0 +1,9 @@
1
+ class Chapter < ActiveRecord::Base
2
+ has_many :sections, dependent: :destroy
3
+ has_many :paragraphs, through: :sections
4
+
5
+ has_many :quotations, dependent: :destroy
6
+ has_many :citations, through: :quotations
7
+
8
+ has_paper_trail
9
+ end
@@ -0,0 +1,5 @@
1
+ class Citation < ActiveRecord::Base
2
+ belongs_to :quotation
3
+
4
+ has_paper_trail
5
+ end
@@ -0,0 +1,15 @@
1
+ require 'securerandom'
2
+
3
+ class CustomPrimaryKeyRecord < ActiveRecord::Base
4
+ self.primary_key = :uuid
5
+
6
+ has_paper_trail class_name: 'CustomPrimaryKeyRecordVersion'
7
+
8
+ # This default_scope is to test the case of the Version#item association
9
+ # not returning the item due to unmatched default_scope on the model.
10
+ default_scope { where(name: 'custom_primary_key_record') }
11
+
12
+ before_create do
13
+ self.uuid ||= SecureRandom.uuid
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ class Customer < ActiveRecord::Base
2
+ has_many :orders, dependent: :destroy
3
+ has_paper_trail
4
+ end
@@ -0,0 +1,6 @@
1
+ class Document < ActiveRecord::Base
2
+ has_paper_trail(
3
+ versions: :paper_trail_versions,
4
+ on: %i[create update]
5
+ )
6
+ end
@@ -0,0 +1,2 @@
1
+ class Dog < Animal
2
+ end
@@ -0,0 +1,4 @@
1
+ # to demonstrate a has_through association that does not have paper_trail enabled
2
+ class Editor < ActiveRecord::Base
3
+ has_many :editorships, dependent: :destroy
4
+ end
@@ -0,0 +1,5 @@
1
+ class Editorship < ActiveRecord::Base
2
+ belongs_to :book
3
+ belongs_to :editor
4
+ has_paper_trail
5
+ end
@@ -0,0 +1,3 @@
1
+ class Elephant < Animal
2
+ paper_trail.disable
3
+ end
@@ -0,0 +1,3 @@
1
+ class Fluxor < ActiveRecord::Base
2
+ belongs_to :widget
3
+ end
@@ -0,0 +1,5 @@
1
+ class FooHabtm < ActiveRecord::Base
2
+ has_and_belongs_to_many :bar_habtms
3
+ accepts_nested_attributes_for :bar_habtms
4
+ has_paper_trail
5
+ end
@@ -0,0 +1,2 @@
1
+ class FooWidget < Widget
2
+ end
@@ -0,0 +1,5 @@
1
+ class Fruit < ActiveRecord::Base
2
+ if ENV['DB'] == 'postgres' || JsonVersion.table_exists?
3
+ has_paper_trail class_name: 'JsonVersion'
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ class Gadget < ActiveRecord::Base
2
+ has_paper_trail ignore: :brand
3
+ end
@@ -0,0 +1,5 @@
1
+ module Kitchen
2
+ class Banana < ActiveRecord::Base
3
+ has_paper_trail class_name: 'Kitchen::BananaVersion'
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ class LegacyWidget < ActiveRecord::Base
2
+ has_paper_trail ignore: :version, version: 'custom_version'
3
+ end
@@ -0,0 +1,4 @@
1
+ class LineItem < ActiveRecord::Base
2
+ belongs_to :order, dependent: :destroy
3
+ has_paper_trail
4
+ end
@@ -0,0 +1,4 @@
1
+ # This model does not record versions when updated.
2
+ class NotOnUpdate < ActiveRecord::Base
3
+ has_paper_trail on: %i[create destroy]
4
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class Create < ActiveRecord::Base
3
+ self.table_name = :on_create
4
+ has_paper_trail on: [:create]
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class Destroy < ActiveRecord::Base
3
+ self.table_name = :on_destroy
4
+ has_paper_trail on: [:destroy]
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class EmptyArray < ActiveRecord::Base
3
+ self.table_name = :on_empty_array
4
+ has_paper_trail on: []
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module On
2
+ class Update < ActiveRecord::Base
3
+ self.table_name = :on_update
4
+ has_paper_trail on: [:update]
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class Order < ActiveRecord::Base
2
+ belongs_to :customer
3
+ has_many :line_items
4
+ has_paper_trail
5
+ end
@@ -0,0 +1,5 @@
1
+ class Paragraph < ActiveRecord::Base
2
+ belongs_to :section
3
+
4
+ has_paper_trail
5
+ end
@@ -0,0 +1,39 @@
1
+ class Person < ActiveRecord::Base
2
+ has_many :authorships, foreign_key: :author_id, dependent: :destroy
3
+ has_many :books, through: :authorships
4
+ belongs_to :mentor, class_name: 'Person', foreign_key: :mentor_id
5
+ has_paper_trail
6
+
7
+ # Convert strings to TimeZone objects when assigned
8
+ def time_zone=(value)
9
+ if value.is_a? ActiveSupport::TimeZone
10
+ super
11
+ else
12
+ zone = ::Time.find_zone(value) # nil if can't find time zone
13
+ super zone
14
+ end
15
+ end
16
+
17
+ # Store TimeZone objects as strings when serialized to database
18
+ class TimeZoneSerializer
19
+ class << self
20
+ def dump(zone)
21
+ zone.try(:name)
22
+ end
23
+
24
+ def load(value)
25
+ ::Time.find_zone(value)
26
+ end
27
+ end
28
+
29
+ def dump(zone)
30
+ self.class.dump(zone)
31
+ end
32
+
33
+ def load(value)
34
+ self.class.load(value)
35
+ end
36
+ end
37
+
38
+ serialize :time_zone, TimeZoneSerializer.new
39
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ActiveRecord::Base
2
+ has_paper_trail class_name: 'PostVersion'
3
+ end
@@ -0,0 +1,7 @@
1
+ # This model tests ActiveRecord::Enum, which was added in AR 4.1
2
+ # http://edgeguides.rubyonrails.org/4_1_release_notes.html#active-record-enums
3
+ class PostWithStatus < ActiveRecord::Base
4
+ has_paper_trail
5
+
6
+ enum status: { draft: 0, published: 1, archived: 2 }
7
+ end
@@ -0,0 +1,5 @@
1
+ class Quotation < ActiveRecord::Base
2
+ belongs_to :chapter
3
+ has_many :citations, dependent: :destroy
4
+ has_paper_trail
5
+ end
@@ -0,0 +1,6 @@
1
+ class Section < ActiveRecord::Base
2
+ belongs_to :chapter
3
+ has_many :paragraphs, dependent: :destroy
4
+
5
+ has_paper_trail
6
+ end
@@ -0,0 +1,3 @@
1
+ class Skipper < ActiveRecord::Base
2
+ has_paper_trail ignore: [:created_at], skip: [:another_timestamp]
3
+ end
@@ -0,0 +1,37 @@
1
+ module OverrideSongAttributesTheRails4Way
2
+ def attributes
3
+ if name
4
+ super.merge(name: name)
5
+ else
6
+ super
7
+ end
8
+ end
9
+
10
+ def changed_attributes
11
+ if name
12
+ super.merge(name: name)
13
+ else
14
+ super
15
+ end
16
+ end
17
+ end
18
+
19
+ class Song < ActiveRecord::Base
20
+ has_paper_trail
21
+
22
+ # Uses an integer of seconds to hold the length of the song
23
+ def length=(minutes)
24
+ write_attribute(:length, minutes.to_i * 60)
25
+ end
26
+
27
+ def length
28
+ read_attribute(:length) / 60
29
+ end
30
+
31
+ if ActiveRecord::VERSION::MAJOR >= 5
32
+ attribute :name, :string
33
+ else
34
+ attr_accessor :name
35
+ prepend OverrideSongAttributesTheRails4Way
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ class Thing < ActiveRecord::Base
2
+ has_paper_trail save_changes: false
3
+ end
@@ -0,0 +1,6 @@
1
+ class Translation < ActiveRecord::Base
2
+ has_paper_trail(
3
+ if: proc { |t| t.language_code == 'US' },
4
+ unless: proc { |t| t.type == 'DRAFT' }
5
+ )
6
+ end
@@ -0,0 +1,4 @@
1
+ class Truck < Vehicle
2
+ # This STI child class specifically does not call `has_paper_trail`.
3
+ # Of the sub-classes of `Vehicle`, only `Car` is versioned.
4
+ end
@@ -0,0 +1,4 @@
1
+ class Vehicle < ActiveRecord::Base
2
+ # This STI parent class specifically does not call `has_paper_trail`.
3
+ # Of its sub-classes, only `Car` is versioned.
4
+ end
@@ -0,0 +1,4 @@
1
+ class Whatchamajigger < ActiveRecord::Base
2
+ has_paper_trail
3
+ belongs_to :owner, polymorphic: true
4
+ end
@@ -0,0 +1,8 @@
1
+ class Widget < ActiveRecord::Base
2
+ EXCLUDED_NAME = 'Biglet'.freeze
3
+ has_paper_trail
4
+ has_one :wotsit
5
+ has_many(:fluxors, -> { order(:name) })
6
+ has_many :whatchamajiggers, as: :owner
7
+ validates :name, exclusion: { in: [EXCLUDED_NAME] }
8
+ end
@@ -0,0 +1,8 @@
1
+ class Wotsit < ActiveRecord::Base
2
+ has_paper_trail
3
+ belongs_to :widget
4
+
5
+ def created_on
6
+ created_at.to_date
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ class CustomPrimaryKeyRecordVersion < PaperTrail::Version
2
+ self.table_name = 'custom_primary_key_record_versions'
3
+ end
@@ -0,0 +1,6 @@
1
+ # The purpose of this custom version class is to test the scope methods on the
2
+ # VersionConcern::ClassMethods module. See
3
+ # https://github.com/airblade/paper_trail/issues/295 for more details.
4
+ class JoinedVersion < PaperTrail::Version
5
+ default_scope { joins('INNER JOIN widgets ON widgets.id = versions.item_id') }
6
+ end
@@ -0,0 +1,3 @@
1
+ class JsonVersion < PaperTrail::Version
2
+ self.table_name = 'json_versions'
3
+ end
@@ -0,0 +1,5 @@
1
+ module Kitchen
2
+ class BananaVersion < PaperTrail::Version
3
+ self.table_name = 'banana_versions'
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ class PostVersion < PaperTrail::Version
2
+ self.table_name = 'post_versions'
3
+ end
@@ -0,0 +1,37 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require 'active_record/railtie'
5
+ require 'action_controller/railtie'
6
+
7
+ Bundler.require(:default, Rails.env)
8
+ require 'paper_trail'
9
+
10
+ module Dummy
11
+ class Application < Rails::Application
12
+ config.encoding = 'utf-8'
13
+ config.filter_parameters += [:password]
14
+ config.active_support.escape_html_entities_in_json = true
15
+ config.active_support.test_order = :sorted
16
+
17
+ # Disable assets in rails 4.2. In rails 5, config does not respond to
18
+ # assets, probably because it was moved out of railties to some other gem,
19
+ # and we only have dev. dependencies on railties, not all of rails. When
20
+ # we drop support for rails 4.2, we can remove this whole conditional.
21
+ config.assets.enabled = false if config.respond_to?(:assets)
22
+
23
+ config.secret_key_base = 'A fox regularly kicked the screaming pile of biscuits.'
24
+
25
+ # `raise_in_transactional_callbacks` was added in rails 4, then deprecated
26
+ # in rails 5. Oh, how fickle are the gods.
27
+ if ActiveRecord.respond_to?(:gem_version)
28
+ v = ActiveRecord.gem_version
29
+ if v >= Gem::Version.new('4.2') && v < Gem::Version.new('5.0.0.beta1')
30
+ config.active_record.raise_in_transactional_callbacks = true
31
+ end
32
+ if v >= Gem::Version.new('5.0.0.beta1')
33
+ config.active_record.time_zone_aware_types = [:datetime]
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+
3
+ # We normally use the root project Gemfile (and gemspec), but when we run rake
4
+ # locally (not on travis) in this dummy app, we set the BUNDLE_GEMFILE env.
5
+ # variable. The project Gemfile/gemspec allows AR 4.0, which is a problem
6
+ # because this dummy app uses `enum` in some of its models, and `enum` was
7
+ # introduced in AR 4.1. So, when we run rake here, we use:
8
+ #
9
+ # BUNDLE_GEMFILE=../../gemfiles/ar_4.2.gemfile bundle exec rake
10
+ #
11
+ # Once we drop support for AR 4.0 and 4.1 this will be less of a problem, but
12
+ # we should keep the ability to specify BUNDLE_GEMFILE because the same
13
+ # situation could come up in the future.
14
+ unless ENV.key?('BUNDLE_GEMFILE')
15
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
16
+ if File.exist?(gemfile)
17
+ puts "Booting PT test dummy app: Using gemfile: #{gemfile}"
18
+ ENV['BUNDLE_GEMFILE'] = gemfile
19
+ end
20
+ end
21
+ require 'bundler'
22
+ Bundler.setup
23
+
24
+ $LOAD_PATH.unshift(File.expand_path('../../../../lib', __FILE__))
@@ -0,0 +1,15 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ test: &test
4
+ adapter: sqlite3
5
+ pool: 5
6
+ timeout: 5000
7
+ database: db/test.sqlite3
8
+
9
+ foo:
10
+ <<: *test
11
+ database: db/test-foo.sqlite3
12
+
13
+ bar:
14
+ <<: *test
15
+ database: db/test-bar.sqlite3
@@ -0,0 +1,15 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ test: &test
4
+ adapter: sqlite3
5
+ pool: 5
6
+ timeout: 5000
7
+ database: db/test.sqlite3
8
+
9
+ foo:
10
+ <<: *test
11
+ database: db/test-foo.sqlite3
12
+
13
+ bar:
14
+ <<: *test
15
+ database: db/test-bar.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,36 @@
1
+ Dummy::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 and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ # config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Log the query plan for queries taking more than this (works
26
+ # with SQLite, MySQL, and PostgreSQL)
27
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
28
+
29
+ # Do not compress assets
30
+ config.assets.compress = false
31
+
32
+ # Debug mode disables concatenation and preprocessing of assets.
33
+ # This option may cause significant delays in view rendering with a large
34
+ # number of complex assets.
35
+ config.assets.debug = true
36
+ end
@@ -0,0 +1,74 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Disable Rails's static asset server (Apache or nginx will already do this)
18
+ config.serve_static_assets = false
19
+
20
+ # Compress JavaScripts and CSS
21
+ config.assets.compress = true
22
+
23
+ # Don't fallback to assets pipeline if a precompiled asset is missed
24
+ config.assets.compile = false
25
+
26
+ # Generate digests for assets URLs
27
+ config.assets.digest = true
28
+
29
+ # Defaults to nil and saved in location specified by config.assets.prefix
30
+ # config.assets.manifest = YOUR_PATH
31
+
32
+ # Specifies the header that your server uses for sending files
33
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
34
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
35
+
36
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
37
+ # config.force_ssl = true
38
+
39
+ # See everything in the log (default is :info)
40
+ # config.log_level = :debug
41
+
42
+ # Prepend all log lines with the following tags
43
+ # config.log_tags = [ :subdomain, :uuid ]
44
+
45
+ # Use a different logger for distributed setups
46
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
47
+
48
+ # Use a different cache store in production
49
+ # config.cache_store = :mem_cache_store
50
+
51
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
52
+ # config.action_controller.asset_host = "http://assets.example.com"
53
+
54
+ # Precompile additional assets (application.js, application.css, and all
55
+ # non-JS/CSS are already added)
56
+ # config.assets.precompile += %w( search.js )
57
+
58
+ # Disable delivery errors, bad email addresses will be ignored
59
+ # config.action_mailer.raise_delivery_errors = false
60
+
61
+ # Enable threaded mode
62
+ # config.threadsafe!
63
+
64
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
65
+ # the I18n.default_locale when a translation can not be found)
66
+ config.i18n.fallbacks = true
67
+
68
+ # Send deprecation notices to registered listeners
69
+ config.active_support.deprecation = :notify
70
+
71
+ # Log the query plan for queries taking more than this (works
72
+ # with SQLite, MySQL, and PostgreSQL)
73
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
74
+ end