paper_trail 5.2.3 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. checksums.yaml +5 -5
  2. data/lib/generators/paper_trail/install/USAGE +3 -0
  3. data/lib/generators/paper_trail/install/install_generator.rb +75 -0
  4. data/lib/generators/paper_trail/{templates/add_object_changes_to_versions.rb → install/templates/add_object_changes_to_versions.rb.erb} +1 -1
  5. data/lib/generators/paper_trail/install/templates/create_versions.rb.erb +36 -0
  6. data/lib/generators/paper_trail/migration_generator.rb +38 -0
  7. data/lib/generators/paper_trail/update_item_subtype/USAGE +4 -0
  8. data/lib/generators/paper_trail/update_item_subtype/templates/update_versions_for_item_subtype.rb.erb +85 -0
  9. data/lib/generators/paper_trail/update_item_subtype/update_item_subtype_generator.rb +17 -0
  10. data/lib/paper_trail.rb +82 -130
  11. data/lib/paper_trail/attribute_serializers/attribute_serializer_factory.rb +27 -0
  12. data/lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb +15 -44
  13. data/lib/paper_trail/attribute_serializers/object_attribute.rb +2 -0
  14. data/lib/paper_trail/attribute_serializers/object_changes_attribute.rb +2 -0
  15. data/lib/paper_trail/cleaner.rb +3 -1
  16. data/lib/paper_trail/compatibility.rb +51 -0
  17. data/lib/paper_trail/config.rb +11 -49
  18. data/lib/paper_trail/events/base.rb +323 -0
  19. data/lib/paper_trail/events/create.rb +32 -0
  20. data/lib/paper_trail/events/destroy.rb +42 -0
  21. data/lib/paper_trail/events/update.rb +60 -0
  22. data/lib/paper_trail/frameworks/active_record.rb +2 -1
  23. data/lib/paper_trail/frameworks/active_record/models/paper_trail/version.rb +8 -3
  24. data/lib/paper_trail/frameworks/cucumber.rb +5 -3
  25. data/lib/paper_trail/frameworks/rails.rb +2 -0
  26. data/lib/paper_trail/frameworks/rails/controller.rb +33 -43
  27. data/lib/paper_trail/frameworks/rails/engine.rb +34 -1
  28. data/lib/paper_trail/frameworks/rspec.rb +17 -4
  29. data/lib/paper_trail/frameworks/rspec/helpers.rb +2 -0
  30. data/lib/paper_trail/has_paper_trail.rb +22 -310
  31. data/lib/paper_trail/model_config.rb +157 -109
  32. data/lib/paper_trail/queries/versions/where_object.rb +65 -0
  33. data/lib/paper_trail/queries/versions/where_object_changes.rb +75 -0
  34. data/lib/paper_trail/record_history.rb +3 -9
  35. data/lib/paper_trail/record_trail.rb +169 -319
  36. data/lib/paper_trail/reifier.rb +53 -374
  37. data/lib/paper_trail/request.rb +166 -0
  38. data/lib/paper_trail/serializers/json.rb +9 -10
  39. data/lib/paper_trail/serializers/yaml.rb +15 -28
  40. data/lib/paper_trail/type_serializers/postgres_array_serializer.rb +48 -0
  41. data/lib/paper_trail/version_concern.rb +160 -155
  42. data/lib/paper_trail/version_number.rb +12 -4
  43. metadata +77 -372
  44. data/.github/CONTRIBUTING.md +0 -109
  45. data/.github/ISSUE_TEMPLATE.md +0 -13
  46. data/.gitignore +0 -23
  47. data/.rspec +0 -2
  48. data/.rubocop.yml +0 -99
  49. data/.rubocop_todo.yml +0 -22
  50. data/.travis.yml +0 -41
  51. data/Appraisals +0 -38
  52. data/CHANGELOG.md +0 -560
  53. data/Gemfile +0 -2
  54. data/MIT-LICENSE +0 -20
  55. data/README.md +0 -1654
  56. data/Rakefile +0 -30
  57. data/doc/bug_report_template.rb +0 -69
  58. data/doc/warning_about_not_setting_whodunnit.md +0 -32
  59. data/gemfiles/ar3.gemfile +0 -19
  60. data/gemfiles/ar4.gemfile +0 -8
  61. data/gemfiles/ar5.gemfile +0 -9
  62. data/lib/generators/paper_trail/USAGE +0 -2
  63. data/lib/generators/paper_trail/default_initializer.rb +0 -0
  64. data/lib/generators/paper_trail/install_generator.rb +0 -57
  65. data/lib/generators/paper_trail/templates/add_transaction_id_column_to_versions.rb +0 -13
  66. data/lib/generators/paper_trail/templates/create_version_associations.rb +0 -22
  67. data/lib/generators/paper_trail/templates/create_versions.rb +0 -80
  68. data/lib/paper_trail/attribute_serializers/legacy_active_record_shim.rb +0 -48
  69. data/lib/paper_trail/frameworks/active_record/models/paper_trail/version_association.rb +0 -11
  70. data/lib/paper_trail/frameworks/sinatra.rb +0 -40
  71. data/lib/paper_trail/version_association_concern.rb +0 -17
  72. data/paper_trail.gemspec +0 -56
  73. data/spec/generators/install_generator_spec.rb +0 -66
  74. data/spec/generators/paper_trail/templates/create_versions_spec.rb +0 -51
  75. data/spec/models/animal_spec.rb +0 -36
  76. data/spec/models/boolit_spec.rb +0 -48
  77. data/spec/models/callback_modifier_spec.rb +0 -96
  78. data/spec/models/car_spec.rb +0 -13
  79. data/spec/models/custom_primary_key_record_spec.rb +0 -18
  80. data/spec/models/fluxor_spec.rb +0 -17
  81. data/spec/models/gadget_spec.rb +0 -68
  82. data/spec/models/joined_version_spec.rb +0 -47
  83. data/spec/models/json_version_spec.rb +0 -102
  84. data/spec/models/kitchen/banana_spec.rb +0 -14
  85. data/spec/models/not_on_update_spec.rb +0 -22
  86. data/spec/models/post_with_status_spec.rb +0 -50
  87. data/spec/models/skipper_spec.rb +0 -46
  88. data/spec/models/thing_spec.rb +0 -11
  89. data/spec/models/truck_spec.rb +0 -5
  90. data/spec/models/vehicle_spec.rb +0 -5
  91. data/spec/models/version_spec.rb +0 -272
  92. data/spec/models/widget_spec.rb +0 -343
  93. data/spec/modules/paper_trail_spec.rb +0 -27
  94. data/spec/modules/version_concern_spec.rb +0 -31
  95. data/spec/modules/version_number_spec.rb +0 -43
  96. data/spec/paper_trail/config_spec.rb +0 -33
  97. data/spec/paper_trail_spec.rb +0 -79
  98. data/spec/rails_helper.rb +0 -34
  99. data/spec/requests/articles_spec.rb +0 -34
  100. data/spec/spec_helper.rb +0 -114
  101. data/spec/support/alt_db_init.rb +0 -54
  102. data/test/custom_json_serializer.rb +0 -13
  103. data/test/dummy/Rakefile +0 -7
  104. data/test/dummy/app/controllers/application_controller.rb +0 -33
  105. data/test/dummy/app/controllers/articles_controller.rb +0 -20
  106. data/test/dummy/app/controllers/test_controller.rb +0 -5
  107. data/test/dummy/app/controllers/widgets_controller.rb +0 -32
  108. data/test/dummy/app/helpers/application_helper.rb +0 -2
  109. data/test/dummy/app/models/animal.rb +0 -6
  110. data/test/dummy/app/models/article.rb +0 -24
  111. data/test/dummy/app/models/authorship.rb +0 -5
  112. data/test/dummy/app/models/bar_habtm.rb +0 -4
  113. data/test/dummy/app/models/book.rb +0 -9
  114. data/test/dummy/app/models/boolit.rb +0 -4
  115. data/test/dummy/app/models/callback_modifier.rb +0 -45
  116. data/test/dummy/app/models/car.rb +0 -3
  117. data/test/dummy/app/models/cat.rb +0 -2
  118. data/test/dummy/app/models/chapter.rb +0 -9
  119. data/test/dummy/app/models/citation.rb +0 -5
  120. data/test/dummy/app/models/custom_primary_key_record.rb +0 -13
  121. data/test/dummy/app/models/customer.rb +0 -4
  122. data/test/dummy/app/models/document.rb +0 -4
  123. data/test/dummy/app/models/dog.rb +0 -2
  124. data/test/dummy/app/models/editor.rb +0 -4
  125. data/test/dummy/app/models/editorship.rb +0 -5
  126. data/test/dummy/app/models/elephant.rb +0 -3
  127. data/test/dummy/app/models/fluxor.rb +0 -3
  128. data/test/dummy/app/models/foo_habtm.rb +0 -5
  129. data/test/dummy/app/models/foo_widget.rb +0 -2
  130. data/test/dummy/app/models/fruit.rb +0 -5
  131. data/test/dummy/app/models/gadget.rb +0 -3
  132. data/test/dummy/app/models/kitchen/banana.rb +0 -5
  133. data/test/dummy/app/models/legacy_widget.rb +0 -4
  134. data/test/dummy/app/models/line_item.rb +0 -4
  135. data/test/dummy/app/models/not_on_update.rb +0 -4
  136. data/test/dummy/app/models/order.rb +0 -5
  137. data/test/dummy/app/models/paragraph.rb +0 -5
  138. data/test/dummy/app/models/person.rb +0 -38
  139. data/test/dummy/app/models/post.rb +0 -3
  140. data/test/dummy/app/models/post_with_status.rb +0 -8
  141. data/test/dummy/app/models/protected_widget.rb +0 -3
  142. data/test/dummy/app/models/quotation.rb +0 -5
  143. data/test/dummy/app/models/section.rb +0 -6
  144. data/test/dummy/app/models/skipper.rb +0 -6
  145. data/test/dummy/app/models/song.rb +0 -41
  146. data/test/dummy/app/models/thing.rb +0 -3
  147. data/test/dummy/app/models/translation.rb +0 -4
  148. data/test/dummy/app/models/truck.rb +0 -4
  149. data/test/dummy/app/models/vehicle.rb +0 -4
  150. data/test/dummy/app/models/whatchamajigger.rb +0 -4
  151. data/test/dummy/app/models/widget.rb +0 -16
  152. data/test/dummy/app/models/wotsit.rb +0 -8
  153. data/test/dummy/app/versions/custom_primary_key_record_version.rb +0 -3
  154. data/test/dummy/app/versions/joined_version.rb +0 -6
  155. data/test/dummy/app/versions/json_version.rb +0 -3
  156. data/test/dummy/app/versions/kitchen/banana_version.rb +0 -5
  157. data/test/dummy/app/versions/post_version.rb +0 -3
  158. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  159. data/test/dummy/config.ru +0 -4
  160. data/test/dummy/config/application.rb +0 -80
  161. data/test/dummy/config/boot.rb +0 -10
  162. data/test/dummy/config/database.mysql.yml +0 -19
  163. data/test/dummy/config/database.postgres.yml +0 -15
  164. data/test/dummy/config/database.sqlite.yml +0 -15
  165. data/test/dummy/config/environment.rb +0 -5
  166. data/test/dummy/config/environments/development.rb +0 -41
  167. data/test/dummy/config/environments/production.rb +0 -74
  168. data/test/dummy/config/environments/test.rb +0 -51
  169. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -9
  170. data/test/dummy/config/initializers/inflections.rb +0 -10
  171. data/test/dummy/config/initializers/mime_types.rb +0 -5
  172. data/test/dummy/config/initializers/paper_trail.rb +0 -9
  173. data/test/dummy/config/initializers/secret_token.rb +0 -9
  174. data/test/dummy/config/initializers/session_store.rb +0 -8
  175. data/test/dummy/config/locales/en.yml +0 -5
  176. data/test/dummy/config/routes.rb +0 -4
  177. data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +0 -361
  178. data/test/dummy/db/schema.rb +0 -288
  179. data/test/dummy/script/rails +0 -8
  180. data/test/functional/controller_test.rb +0 -90
  181. data/test/functional/enabled_for_controller_test.rb +0 -28
  182. data/test/functional/modular_sinatra_test.rb +0 -46
  183. data/test/functional/sinatra_test.rb +0 -51
  184. data/test/functional/thread_safety_test.rb +0 -46
  185. data/test/test_helper.rb +0 -127
  186. data/test/time_travel_helper.rb +0 -1
  187. data/test/unit/associations_test.rb +0 -1016
  188. data/test/unit/cleaner_test.rb +0 -188
  189. data/test/unit/inheritance_column_test.rb +0 -43
  190. data/test/unit/model_test.rb +0 -1489
  191. data/test/unit/protected_attrs_test.rb +0 -52
  192. data/test/unit/serializer_test.rb +0 -119
  193. data/test/unit/serializers/json_test.rb +0 -95
  194. data/test/unit/serializers/mixin_json_test.rb +0 -37
  195. data/test/unit/serializers/mixin_yaml_test.rb +0 -53
  196. data/test/unit/serializers/yaml_test.rb +0 -54
  197. data/test/unit/timestamp_test.rb +0 -41
  198. data/test/unit/version_test.rb +0 -119
@@ -1,3 +0,0 @@
1
- class PostVersion < PaperTrail::Version
2
- self.table_name = "post_versions"
3
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag :all %>
6
- <%= javascript_include_tag :defaults %>
7
- <%= csrf_meta_tag %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path("../config/environment", __FILE__)
4
- run Dummy::Application
@@ -1,80 +0,0 @@
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) if defined?(Bundler)
8
- require "paper_trail"
9
-
10
- module Dummy
11
- class Application < Rails::Application
12
- # Settings in config/environments/* take precedence over those specified here.
13
- # Application configuration should go into files in config/initializers
14
- # -- all .rb files in that directory are automatically loaded.
15
-
16
- # Custom directories with classes and modules you want to be autoloadable.
17
- # config.autoload_paths += %W(#{config.root}/extras)
18
-
19
- # Only load the plugins named here, in the order given (default is alphabetical).
20
- # :all can be used as a placeholder for all plugins not explicitly named.
21
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
22
-
23
- # Activate observers that should always be running.
24
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
25
-
26
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
27
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
28
- # config.time_zone = 'Central Time (US & Canada)'
29
-
30
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
- # config.i18n.default_locale = :de
33
-
34
- # Configure the default encoding used in templates for Ruby 1.9.
35
- config.encoding = "utf-8"
36
-
37
- # Configure sensitive parameters which will be filtered from the log file.
38
- config.filter_parameters += [:password]
39
-
40
- # Enable escaping HTML in JSON.
41
- config.active_support.escape_html_entities_in_json = true
42
-
43
- # Use SQL instead of Active Record's schema dumper when creating the database.
44
- # This is necessary if your schema can't be completely dumped by the schema dumper,
45
- # like if you have constraints or database-specific column types
46
- # config.active_record.schema_format = :sql
47
-
48
- # Enforce whitelist mode for mass assignment.
49
- # This will create an empty whitelist of attributes available for mass-assignment for all models
50
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
51
- # parameters by using an attr_accessible or attr_protected declaration.
52
- if ::PaperTrail.active_record_protected_attributes?
53
- config.active_record.whitelist_attributes = false
54
- end
55
-
56
- # `config.assets` is a `NoMethodError` in rails 5.
57
- config.assets.enabled = false if config.respond_to?(:assets)
58
-
59
- # Version of your assets, change this if you want to expire all your assets
60
- # config.assets.version = '1.0'
61
-
62
- # Rails 4 key for generating secret key
63
- config.secret_key_base = "A fox regularly kicked the screaming pile of biscuits."
64
-
65
- # `raise_in_transactional_callbacks` was added in rails 4, then deprecated
66
- # in rails 5. Oh, how fickle are the gods.
67
- if ActiveRecord.respond_to?(:gem_version)
68
- v = ActiveRecord.gem_version
69
- if v >= Gem::Version.new("4.2") && v < Gem::Version.new("5.0.0.beta1")
70
- config.active_record.raise_in_transactional_callbacks = true
71
- end
72
- if v >= Gem::Version.new("5.0.0.beta1")
73
- config.active_record.time_zone_aware_types = [:datetime]
74
- end
75
- end
76
-
77
- # Set test order for Test::Unit if possible
78
- config.active_support.test_order = :sorted if config.active_support.respond_to?(:test_order=)
79
- end
80
- end
@@ -1,10 +0,0 @@
1
- require "rubygems"
2
- gemfile = File.expand_path("../../../../Gemfile", __FILE__)
3
-
4
- if File.exist?(gemfile)
5
- ENV["BUNDLE_GEMFILE"] = gemfile
6
- require "bundler"
7
- Bundler.setup
8
- end
9
-
10
- $LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)
@@ -1,19 +0,0 @@
1
- test: &test
2
- adapter: mysql2
3
- encoding: utf8
4
- database: paper_trail_test
5
- pool: 5
6
- username: root
7
- password:
8
- host: localhost
9
-
10
- # Warning: The database defined as "test" will be erased and
11
- # re-generated from your development database when you run "rake".
12
- # Do not set this db to the same as development or production.
13
- foo:
14
- <<: *test
15
- database: paper_trail_foo
16
-
17
- bar:
18
- <<: *test
19
- database: paper_trail_bar
@@ -1,15 +0,0 @@
1
- test: &test
2
- adapter: postgresql
3
- database: paper_trail_test
4
- username: postgres
5
- password:
6
- host: localhost
7
- port: 5432
8
-
9
- foo:
10
- <<: *test
11
- database: paper_trail_foo
12
-
13
- bar:
14
- <<: *test
15
- database: paper_trail_bar
@@ -1,15 +0,0 @@
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
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path("../application", __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
@@ -1,41 +0,0 @@
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
- # Raise exception on mass assignment protection for Active Record models
26
- if ::PaperTrail.active_record_protected_attributes?
27
- config.active_record.mass_assignment_sanitizer = :strict
28
- end
29
-
30
- # Log the query plan for queries taking more than this (works
31
- # with SQLite, MySQL, and PostgreSQL)
32
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
33
-
34
- # Do not compress assets
35
- config.assets.compress = false
36
-
37
- # Debug mode disables concatenation and preprocessing of assets.
38
- # This option may cause significant delays in view rendering with a large
39
- # number of complex assets.
40
- config.assets.debug = true
41
- end
@@ -1,74 +0,0 @@
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
@@ -1,51 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Eager loads all registered namespaces
11
- config.eager_load = true
12
-
13
- if config.respond_to?(:public_file_server)
14
- config.public_file_server.enabled = true
15
- elsif config.respond_to?(:serve_static_files=)
16
- config.serve_static_files = true
17
- else
18
- config.serve_static_assets = true
19
- end
20
-
21
- if config.respond_to?(:public_file_server)
22
- config.public_file_server.headers = {
23
- "Cache-Control" => "public, max-age=3600"
24
- }
25
- else
26
- config.static_cache_control = "public, max-age=3600"
27
- end
28
-
29
- # Show full error reports and disable caching
30
- config.consider_all_requests_local = true
31
- config.action_controller.perform_caching = false
32
-
33
- # Raise exceptions instead of rendering exception templates
34
- config.action_dispatch.show_exceptions = false
35
-
36
- # Disable request forgery protection in test environment
37
- config.action_controller.allow_forgery_protection = false
38
-
39
- # Tell Action Mailer not to deliver emails to the real world.
40
- # The :test delivery method accumulates sent emails in the
41
- # ActionMailer::Base.deliveries array.
42
- # config.action_mailer.delivery_method = :test
43
-
44
- # Raise exception on mass assignment protection for Active Record models
45
- if ::PaperTrail.active_record_protected_attributes?
46
- config.active_record.mass_assignment_sanitizer = :strict
47
- end
48
-
49
- # Print deprecation notices to the stderr
50
- config.active_support.deprecation = :stderr
51
- end
@@ -1,9 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish
4
- # to see in your backtraces.
5
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6
-
7
- # You can also remove all the silencers if you're trying to debug a problem that
8
- # might stem from framework code.
9
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,9 +0,0 @@
1
- PaperTrail.config.track_associations = true
2
-
3
- module PaperTrail
4
- class Version < ActiveRecord::Base
5
- if ::PaperTrail.active_record_protected_attributes?
6
- attr_accessible :answer, :action, :question, :article_id, :ip, :user_agent, :title
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = "99c0312cf416079a8c7ccc63acb1e9f4f" +
8
- "17741398ec8022a2f4fb509c57f55b72486573e9816a026f507efbcd452a9e954d45c93c" +
9
- "95d5bacd87e664ad6805d3f"
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, key: "_dummy_session"
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # Dummy::Application.config.session_store :active_record_store
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,4 +0,0 @@
1
- Dummy::Application.routes.draw do
2
- resources :articles, only: [:create]
3
- resources :widgets, only: [:create, :update, :destroy]
4
- end
@@ -1,361 +0,0 @@
1
- # Keep this migration in sync with
2
- # `lib/generators/paper_trail/templates/create_versions.rb`
3
- # TODO: Is there a way to avoid duplication?
4
- class SetUpTestTables < ActiveRecord::Migration
5
- MYSQL_ADAPTERS = [
6
- "ActiveRecord::ConnectionAdapters::MysqlAdapter",
7
- "ActiveRecord::ConnectionAdapters::Mysql2Adapter"
8
- ].freeze
9
- TEXT_BYTES = 1_073_741_823
10
-
11
- def up
12
- # Classes: Vehicle, Car, Truck
13
- create_table :vehicles, force: true do |t|
14
- t.string :name, null: false
15
- t.string :type, null: false
16
- t.timestamps null: false
17
- end
18
-
19
- create_table :skippers, force: true do |t|
20
- t.string :name
21
- t.datetime :another_timestamp
22
- t.timestamps null: true
23
- end
24
-
25
- create_table :widgets, force: true do |t|
26
- t.string :name
27
- t.text :a_text
28
- t.integer :an_integer
29
- t.float :a_float
30
- t.decimal :a_decimal, precision: 6, scale: 4
31
- t.datetime :a_datetime
32
- t.time :a_time
33
- t.date :a_date
34
- t.boolean :a_boolean
35
- t.string :type
36
- t.timestamps null: true
37
- end
38
-
39
- create_table :versions, versions_table_options do |t|
40
- t.string :item_type, item_type_options
41
- t.integer :item_id, null: false
42
- t.string :event, null: false
43
- t.string :whodunnit
44
- t.text :object, limit: TEXT_BYTES
45
- t.text :object_changes, limit: TEXT_BYTES
46
- t.integer :transaction_id
47
- t.datetime :created_at
48
-
49
- # Metadata columns.
50
- t.integer :answer
51
- t.string :action
52
- t.string :question
53
- t.integer :article_id
54
- t.string :title
55
-
56
- # Controller info columns.
57
- t.string :ip
58
- t.string :user_agent
59
- end
60
- add_index :versions, [:item_type, :item_id]
61
-
62
- create_table :version_associations do |t|
63
- t.integer :version_id
64
- t.string :foreign_key_name, null: false
65
- t.integer :foreign_key_id
66
- end
67
- add_index :version_associations, [:version_id]
68
- add_index :version_associations,
69
- [:foreign_key_name, :foreign_key_id],
70
- name: "index_version_associations_on_foreign_key"
71
-
72
- create_table :post_versions, force: true do |t|
73
- t.string :item_type, null: false
74
- t.integer :item_id, null: false
75
- t.string :event, null: false
76
- t.string :whodunnit
77
- t.text :object
78
- t.datetime :created_at
79
-
80
- # Controller info columns.
81
- t.string :ip
82
- t.string :user_agent
83
- end
84
- add_index :post_versions, [:item_type, :item_id]
85
-
86
- if ENV["DB"] == "postgres" && ::ActiveRecord::VERSION::MAJOR >= 4
87
- create_table :json_versions, force: true do |t|
88
- t.string :item_type, null: false
89
- t.integer :item_id, null: false
90
- t.string :event, null: false
91
- t.string :whodunnit
92
- t.json :object
93
- t.json :object_changes
94
- t.datetime :created_at
95
- end
96
- add_index :json_versions, [:item_type, :item_id]
97
- end
98
-
99
- create_table :not_on_updates, force: true do |t|
100
- t.timestamps null: true
101
- end
102
-
103
- create_table :bananas, force: true do |t|
104
- t.timestamps null: true
105
- end
106
-
107
- create_table :banana_versions, force: true do |t|
108
- t.string :item_type, null: false
109
- t.integer :item_id, null: false
110
- t.string :event, null: false
111
- t.string :whodunnit
112
- t.text :object
113
- t.datetime :created_at
114
- end
115
- add_index :banana_versions, [:item_type, :item_id]
116
-
117
- create_table :wotsits, force: true do |t|
118
- t.integer :widget_id
119
- t.string :name
120
- t.timestamps null: true
121
- end
122
-
123
- create_table :fluxors, force: true do |t|
124
- t.integer :widget_id
125
- t.string :name
126
- end
127
-
128
- create_table :whatchamajiggers, force: true do |t|
129
- t.string :owner_type
130
- t.integer :owner_id
131
- t.string :name
132
- end
133
-
134
- create_table :articles, force: true do |t|
135
- t.string :title
136
- t.string :content
137
- t.string :abstract
138
- t.string :file_upload
139
- end
140
-
141
- create_table :books, force: true do |t|
142
- t.string :title
143
- end
144
-
145
- create_table :authorships, force: true do |t|
146
- t.integer :book_id
147
- t.integer :author_id
148
- end
149
-
150
- create_table :people, force: true do |t|
151
- t.string :name
152
- t.string :time_zone
153
- end
154
-
155
- create_table :editorships, force: true do |t|
156
- t.integer :book_id
157
- t.integer :editor_id
158
- end
159
-
160
- create_table :editors, force: true do |t|
161
- t.string :name
162
- end
163
-
164
- create_table :songs, force: true do |t|
165
- t.integer :length
166
- end
167
-
168
- create_table :posts, force: true do |t|
169
- t.string :title
170
- t.string :content
171
- end
172
-
173
- create_table :post_with_statuses, force: true do |t|
174
- t.integer :status
175
- t.timestamps null: false
176
- end
177
-
178
- create_table :animals, force: true do |t|
179
- t.string :name
180
- t.string :species # single table inheritance column
181
- end
182
-
183
- create_table :documents, force: true do |t|
184
- t.string :name
185
- end
186
-
187
- create_table :legacy_widgets, force: true do |t|
188
- t.string :name
189
- t.integer :version
190
- end
191
-
192
- create_table :things, force: true do |t|
193
- t.string :name
194
- end
195
-
196
- create_table :translations, force: true do |t|
197
- t.string :headline
198
- t.string :content
199
- t.string :language_code
200
- t.string :type
201
- end
202
-
203
- create_table :gadgets, force: true do |t|
204
- t.string :name
205
- t.string :brand
206
- t.timestamps null: true
207
- end
208
-
209
- create_table :customers, force: true do |t|
210
- t.string :name
211
- end
212
-
213
- create_table :orders, force: true do |t|
214
- t.integer :customer_id
215
- t.string :order_date
216
- end
217
-
218
- create_table :line_items, force: true do |t|
219
- t.integer :order_id
220
- t.string :product
221
- end
222
-
223
- create_table :fruits, force: true do |t|
224
- t.string :name
225
- t.string :color
226
- end
227
-
228
- create_table :boolits, force: true do |t|
229
- t.string :name
230
- t.boolean :scoped, default: true
231
- end
232
-
233
- create_table :callback_modifiers, force: true do |t|
234
- t.string :some_content
235
- t.boolean :deleted, default: false
236
- end
237
-
238
- create_table :chapters, force: true do |t|
239
- t.string :name
240
- end
241
-
242
- create_table :sections, force: true do |t|
243
- t.integer :chapter_id
244
- t.string :name
245
- end
246
-
247
- create_table :paragraphs, force: true do |t|
248
- t.integer :section_id
249
- t.string :name
250
- end
251
-
252
- create_table :quotations, force: true do |t|
253
- t.integer :chapter_id
254
- end
255
-
256
- create_table :citations, force: true do |t|
257
- t.integer :quotation_id
258
- end
259
-
260
- create_table :foo_habtms, force: true do |t|
261
- t.string :name
262
- end
263
-
264
- create_table :bar_habtms, force: true do |t|
265
- t.string :name
266
- end
267
-
268
- create_table :bar_habtms_foo_habtms, force: true, id: false do |t|
269
- t.integer :foo_habtm_id
270
- t.integer :bar_habtm_id
271
- end
272
- add_index :bar_habtms_foo_habtms, [:foo_habtm_id]
273
- add_index :bar_habtms_foo_habtms, [:bar_habtm_id]
274
-
275
- # custom_primary_key_records use a uuid column (string)
276
- create_table :custom_primary_key_records, id: false, force: true do |t|
277
- t.column :uuid, :string, primary_key: true
278
- t.string :name
279
- t.timestamps null: true
280
- end
281
-
282
- # and custom_primary_key_record_versions stores the uuid in item_id, a string
283
- create_table :custom_primary_key_record_versions, force: true do |t|
284
- t.string :item_type, null: false
285
- t.string :item_id, null: false
286
- t.string :event, null: false
287
- t.string :whodunnit
288
- t.text :object
289
- t.datetime :created_at
290
- end
291
- add_index :custom_primary_key_record_versions, [:item_type, :item_id], name: "idx_cust_pk_item"
292
- end
293
-
294
- def down
295
- drop_table :bar_habtms_foo_habtms
296
- drop_table :foo_habtms
297
- drop_table :bar_habtms
298
- drop_table :citations
299
- drop_table :quotations
300
- drop_table :animals
301
- drop_table :skippers
302
- drop_table :not_on_updates
303
- drop_table :posts
304
- drop_table :songs
305
- drop_table :editors
306
- drop_table :editorships
307
- drop_table :people
308
- drop_table :authorships
309
- drop_table :books
310
- drop_table :articles
311
- drop_table :whatchamajiggers
312
- drop_table :fluxors
313
- drop_table :wotsits
314
- remove_index :post_versions, column: [:item_type, :item_id]
315
- drop_table :post_versions
316
- remove_index :versions, column: [:item_type, :item_id]
317
- drop_table :versions
318
- if JsonVersion.table_exists?
319
- remove_index :json_versions, column: [:item_type, :item_id]
320
- drop_table :json_versions
321
- end
322
- drop_table :widgets
323
- drop_table :documents
324
- drop_table :legacy_widgets
325
- drop_table :things
326
- drop_table :translations
327
- drop_table :gadgets
328
- drop_table :customers
329
- drop_table :orders
330
- drop_table :line_items
331
- drop_table :fruits
332
- drop_table :boolits
333
- drop_table :chapters
334
- drop_table :sections
335
- drop_table :paragraphs
336
- remove_index :version_associations, column: [:version_id]
337
- remove_index :version_associations, name: "index_version_associations_on_foreign_key"
338
- drop_table :version_associations
339
- drop_table :callback_modifiers
340
- end
341
-
342
- private
343
-
344
- def item_type_options
345
- opt = { null: false }
346
- opt[:limit] = 191 if mysql?
347
- opt
348
- end
349
-
350
- def mysql?
351
- MYSQL_ADAPTERS.include?(connection.class.name)
352
- end
353
-
354
- def versions_table_options
355
- if mysql?
356
- { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" }
357
- else
358
- {}
359
- end
360
- end
361
- end