activerecord_cache 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fecb86dd42b882d6a12115f86055b869d3df8e5b
4
- data.tar.gz: 3045d66663380cb8c03727af1a22c90e57858aa5
3
+ metadata.gz: 49ab2ba1d3d553b39f38b554d7f86d29793e7324
4
+ data.tar.gz: 74a0de7569487d00354dd5dda6a895518c179932
5
5
  SHA512:
6
- metadata.gz: ba80e163493cda91b090529fd1d1b81f27d7fc21fa4e99e77bcf8dd010b8592c0c2ddf45391022f1de9ef0aa19bd1b7293bd33eba0146e68720c463d2f538605
7
- data.tar.gz: 928688eaed5dc868736abf2c02504996a4dee9da9c77a5364784436a50de61c14de030bafb16a4c6e7c998fa31132a694c8ed355d0e200ca9f2a91634e73d4ca
6
+ metadata.gz: 3e4a9b6fb97c2c0e8ba3a79dc68c1d240bf1a6054c3af7e32466ea3380c19cf6c55cc45841abe49f56e18e9e34680f85a6441daecfd15819f0ad56c5a2f1086e
7
+ data.tar.gz: ae982824b34c6bf62c249293ec70982f836552e5251d7f132bafb5a19a0d73693e7b5996e3dc1f7710ede2d24c8d52023021a36351e9a41073217b39824b3a69
data/Gemfile.lock CHANGED
@@ -1,91 +1,111 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord_cache (0.0.9)
5
- rails (~> 4.0)
4
+ activerecord_cache (0.0.10)
5
+ rails (~> 4.2)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (4.1.5)
11
- actionpack (= 4.1.5)
12
- actionview (= 4.1.5)
13
- mail (~> 2.5.4)
14
- actionpack (4.1.5)
15
- actionview (= 4.1.5)
16
- activesupport (= 4.1.5)
17
- rack (~> 1.5.2)
10
+ actionmailer (4.2.0)
11
+ actionpack (= 4.2.0)
12
+ actionview (= 4.2.0)
13
+ activejob (= 4.2.0)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.0)
17
+ actionview (= 4.2.0)
18
+ activesupport (= 4.2.0)
19
+ rack (~> 1.6.0)
18
20
  rack-test (~> 0.6.2)
19
- actionview (4.1.5)
20
- activesupport (= 4.1.5)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
23
+ actionview (4.2.0)
24
+ activesupport (= 4.2.0)
21
25
  builder (~> 3.1)
22
26
  erubis (~> 2.7.0)
23
- activemodel (4.1.5)
24
- activesupport (= 4.1.5)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
29
+ activejob (4.2.0)
30
+ activesupport (= 4.2.0)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.0)
33
+ activesupport (= 4.2.0)
25
34
  builder (~> 3.1)
26
- activerecord (4.1.5)
27
- activemodel (= 4.1.5)
28
- activesupport (= 4.1.5)
29
- arel (~> 5.0.0)
30
- activesupport (4.1.5)
31
- i18n (~> 0.6, >= 0.6.9)
35
+ activerecord (4.2.0)
36
+ activemodel (= 4.2.0)
37
+ activesupport (= 4.2.0)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.0)
40
+ i18n (~> 0.7)
32
41
  json (~> 1.7, >= 1.7.7)
33
42
  minitest (~> 5.1)
34
- thread_safe (~> 0.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
35
44
  tzinfo (~> 1.1)
36
- arel (5.0.1.20140414130214)
37
- bourne (1.5.0)
38
- mocha (>= 0.13.2, < 0.15)
45
+ arel (6.0.0)
46
+ bourne (1.6.0)
47
+ mocha (~> 1.1)
39
48
  builder (3.2.2)
40
49
  erubis (2.7.0)
50
+ globalid (0.3.3)
51
+ activesupport (>= 4.1.0)
41
52
  hike (1.2.3)
42
- i18n (0.6.11)
43
- json (1.8.1)
44
- mail (2.5.4)
45
- mime-types (~> 1.16)
46
- treetop (~> 1.4.8)
53
+ i18n (0.7.0)
54
+ json (1.8.2)
55
+ loofah (2.0.1)
56
+ nokogiri (>= 1.5.9)
57
+ mail (2.6.3)
58
+ mime-types (>= 1.16, < 3)
47
59
  metaclass (0.0.4)
48
- mime-types (1.25.1)
49
- minitest (5.4.2)
50
- mocha (0.14.0)
60
+ mime-types (2.4.3)
61
+ mini_portile (0.6.2)
62
+ minitest (5.5.1)
63
+ mocha (1.1.0)
51
64
  metaclass (~> 0.0.1)
52
65
  multi_json (1.10.1)
53
- polyglot (0.3.5)
54
- rack (1.5.2)
55
- rack-test (0.6.2)
66
+ nokogiri (1.6.6.2)
67
+ mini_portile (~> 0.6.0)
68
+ rack (1.6.0)
69
+ rack-test (0.6.3)
56
70
  rack (>= 1.0)
57
- rails (4.1.5)
58
- actionmailer (= 4.1.5)
59
- actionpack (= 4.1.5)
60
- actionview (= 4.1.5)
61
- activemodel (= 4.1.5)
62
- activerecord (= 4.1.5)
63
- activesupport (= 4.1.5)
71
+ rails (4.2.0)
72
+ actionmailer (= 4.2.0)
73
+ actionpack (= 4.2.0)
74
+ actionview (= 4.2.0)
75
+ activejob (= 4.2.0)
76
+ activemodel (= 4.2.0)
77
+ activerecord (= 4.2.0)
78
+ activesupport (= 4.2.0)
64
79
  bundler (>= 1.3.0, < 2.0)
65
- railties (= 4.1.5)
66
- sprockets-rails (~> 2.0)
67
- railties (4.1.5)
68
- actionpack (= 4.1.5)
69
- activesupport (= 4.1.5)
80
+ railties (= 4.2.0)
81
+ sprockets-rails
82
+ rails-deprecated_sanitizer (1.0.3)
83
+ activesupport (>= 4.2.0.alpha)
84
+ rails-dom-testing (1.0.5)
85
+ activesupport (>= 4.2.0.beta, < 5.0)
86
+ nokogiri (~> 1.6.0)
87
+ rails-deprecated_sanitizer (>= 1.0.1)
88
+ rails-html-sanitizer (1.0.1)
89
+ loofah (~> 2.0)
90
+ railties (4.2.0)
91
+ actionpack (= 4.2.0)
92
+ activesupport (= 4.2.0)
70
93
  rake (>= 0.8.7)
71
94
  thor (>= 0.18.1, < 2.0)
72
- rake (10.3.2)
73
- sprockets (2.12.1)
95
+ rake (10.4.2)
96
+ sprockets (2.12.3)
74
97
  hike (~> 1.2)
75
98
  multi_json (~> 1.0)
76
99
  rack (~> 1.0)
77
100
  tilt (~> 1.1, != 1.3.0)
78
- sprockets-rails (2.1.4)
101
+ sprockets-rails (2.2.4)
79
102
  actionpack (>= 3.0)
80
103
  activesupport (>= 3.0)
81
- sprockets (~> 2.8)
82
- sqlite3 (1.3.9)
104
+ sprockets (>= 2.8, < 4.0)
105
+ sqlite3 (1.3.10)
83
106
  thor (0.19.1)
84
107
  thread_safe (0.3.4)
85
108
  tilt (1.4.1)
86
- treetop (1.4.15)
87
- polyglot
88
- polyglot (>= 0.3.1)
89
109
  tzinfo (1.2.2)
90
110
  thread_safe (~> 0.1)
91
111
 
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.licenses = ['MIT']
19
19
 
20
- s.add_dependency 'rails', ['~> 4.0']
20
+ s.add_dependency 'rails', ['~> 4.2']
21
21
  end
@@ -0,0 +1,19 @@
1
+ module ActiveRecordCache
2
+ module Core
3
+
4
+ def find(*args)
5
+ # Only handle single integer ids
6
+ return super(*args) unless use_activerecord_cache && args.length == 1 && !args.first.kind_of?(Array)
7
+
8
+ id = args.first
9
+ record = find_through_cache(id)
10
+
11
+ unless record
12
+ raise ActiveRecord::RecordNotFound, "Couldn't find #{name} with '#{primary_key}'=#{id}"
13
+ end
14
+
15
+ record
16
+ end
17
+
18
+ end
19
+ end
@@ -31,7 +31,7 @@ module ActiveRecordCache
31
31
 
32
32
  # only support the most basic lookups through the cache
33
33
  def cached_lookup_allowed?
34
- @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sql.nil? && @limit_value.nil? && @offset_value.nil?
34
+ @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sources.empty? && @limit_value.nil? && @offset_value.nil?
35
35
  end
36
36
  end
37
37
  end
@@ -12,6 +12,13 @@ class ActiveRecordCache::Railtie < Rails::Railtie
12
12
  # FinderMethods only gets included in ActiveRecord::Relation, so extend it there.
13
13
  # This gets around some headaches caused by extending modules already included in other classes.
14
14
  ActiveRecord::Relation.send(:include, ActiveRecordCache::FinderMethods)
15
+
16
+ ActiveRecord::Base.class_eval do
17
+ class << self
18
+ prepend ActiveRecordCache::Core
19
+ end
20
+ end
21
+
15
22
  end
16
23
  end
17
24
 
@@ -2,7 +2,7 @@ module ActiveRecordCache
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 9
5
+ TINY = 10
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -2,6 +2,7 @@ module ActiveRecordCache
2
2
  end
3
3
 
4
4
  require File.join(File.dirname(__FILE__), 'activerecord_cache/base')
5
+ require File.join(File.dirname(__FILE__), 'activerecord_cache/core')
5
6
  require File.join(File.dirname(__FILE__), 'activerecord_cache/finder_methods')
6
7
  require File.join(File.dirname(__FILE__), 'activerecord_cache/belongs_to_association')
7
8
  require File.join(File.dirname(__FILE__), 'activerecord_cache/belongs_to_preloader')
@@ -4,6 +4,9 @@ class ActiveRecordCacheTest < ActiveSupport::TestCase
4
4
 
5
5
  setup do
6
6
  Rails.cache.clear
7
+
8
+ # Not sure why, but mocha expectations aren't being cleared between tests…
9
+ Mocha::Mockery.instance.stubba.unstub_all
7
10
  end
8
11
 
9
12
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ # ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -2,8 +2,9 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
5
7
  Bundler.require(*Rails.groups)
6
- require "activerecord_cache"
7
8
 
8
9
  module Dummy
9
10
  class Application < Rails::Application
@@ -11,16 +12,6 @@ module Dummy
11
12
  # Application configuration should go into files in config/initializers
12
13
  # -- all .rb files in that directory are automatically loaded.
13
14
 
14
- # Custom directories with classes and modules you want to be autoloadable.
15
- # config.autoload_paths += %W(#{config.root}/extras)
16
-
17
- # Only load the plugins named here, in the order given (default is alphabetical).
18
- # :all can be used as a placeholder for all plugins not explicitly named.
19
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
-
21
- # Activate observers that should always be running.
22
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
-
24
15
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
16
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
17
  # config.time_zone = 'Central Time (US & Canada)'
@@ -29,27 +20,10 @@ module Dummy
29
20
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
21
  # config.i18n.default_locale = :de
31
22
 
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
37
-
38
- # Enable escaping HTML in JSON.
39
- config.active_support.escape_html_entities_in_json = true
40
-
41
- # Use SQL instead of Active Record's schema dumper when creating the database.
42
- # This is necessary if your schema can't be completely dumped by the schema dumper,
43
- # like if you have constraints or database-specific column types
44
- # config.active_record.schema_format = :sql
45
-
46
- # Enable the asset pipeline
47
- config.assets.enabled = true
48
-
49
- # Version of your assets, change this if you want to expire all your assets
50
- config.assets.version = '1.0'
51
-
23
+ # Use process memory for the Rails cache.
52
24
  config.cache_store = :memory_store
25
+
26
+ # Do not swallow errors in after_commit/after_rollback callbacks.
27
+ config.active_record.raise_in_transactional_callbacks = true
53
28
  end
54
29
  end
55
-
@@ -1,10 +1,3 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
1
+ # ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
2
 
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,5 +1,5 @@
1
- # Load the rails application
1
+ # Load the Rails application.
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -1,39 +1,41 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
5
  # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching
12
+ # Show full error reports and disable caching.
13
13
  config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
- # Don't care if the mailer can't send
16
+ # Don't care if the mailer can't send.
17
17
  config.action_mailer.raise_delivery_errors = false
18
18
 
19
- # Print deprecation notices to the Rails logger
19
+ # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
24
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
27
29
 
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
31
33
 
32
- # Do not compress assets
33
- config.assets.compress = false
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
34
38
 
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
37
-
38
- config.eager_load = false
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
39
41
  end
@@ -1,70 +1,79 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded 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.
8
14
  config.consider_all_requests_local = false
9
15
  config.action_controller.perform_caching = true
10
16
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
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
13
22
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
16
26
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
32
  config.assets.compile = false
19
33
 
20
- # Generate digests for assets URLs
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.
21
36
  config.assets.digest = true
22
37
 
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
25
39
 
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
29
43
 
30
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
45
  # config.force_ssl = true
32
46
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
35
50
 
36
- # Prepend all log lines with the following tags
51
+ # Prepend all log lines with the following tags.
37
52
  # config.log_tags = [ :subdomain, :uuid ]
38
53
 
39
- # Use a different logger for distributed setups
54
+ # Use a different logger for distributed setups.
40
55
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
56
 
42
- # Use a different cache store in production
57
+ # Use a different cache store in production.
43
58
  # config.cache_store = :mem_cache_store
44
59
 
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
47
-
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
50
62
 
51
- # Disable delivery errors, bad email addresses will be ignored
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
65
  # config.action_mailer.raise_delivery_errors = false
53
66
 
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
67
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
68
+ # the I18n.default_locale when a translation cannot be found).
59
69
  config.i18n.fallbacks = true
60
70
 
61
- # Send deprecation notices to registered listeners
71
+ # Send deprecation notices to registered listeners.
62
72
  config.active_support.deprecation = :notify
63
73
 
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
-
68
- config.eager_load = true
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
69
76
 
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
70
79
  end
@@ -1,5 +1,5 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
5
  # test suite. You never need to work with it otherwise. Remember that
@@ -7,27 +7,39 @@ Dummy::Application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
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'
13
18
 
14
- # Show full error reports and disable caching
19
+ # Show full error reports and disable caching.
15
20
  config.consider_all_requests_local = true
16
21
  config.action_controller.perform_caching = false
17
22
 
18
- # Raise exceptions instead of rendering exception templates
23
+ # Raise exceptions instead of rendering exception templates.
19
24
  config.action_dispatch.show_exceptions = false
20
25
 
21
- # Disable request forgery protection in test environment
22
- config.action_controller.allow_forgery_protection = false
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
23
28
 
24
29
  # Tell Action Mailer not to deliver emails to the real world.
25
30
  # The :test delivery method accumulates sent emails in the
26
31
  # ActionMailer::Base.deliveries array.
27
32
  config.action_mailer.delivery_method = :test
28
33
 
29
- # Print deprecation notices to the stderr
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
37
+ # Print deprecation notices to the stderr.
30
38
  config.active_support.deprecation = :stderr
31
39
 
32
- config.eager_load = false
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ # Don't try to create test databases
44
+ config.active_record.maintain_test_schema = false
33
45
  end
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :marshal
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -1,15 +1,16 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
6
7
  # inflect.plural /^(ox)$/i, '\1en'
7
8
  # inflect.singular /^(ox)en/i, '\1'
8
9
  # inflect.irregular 'person', 'people'
9
10
  # inflect.uncountable %w( fish sheep )
10
11
  # end
11
- #
12
+
12
13
  # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
14
15
  # inflect.acronym 'RESTful'
15
16
  # end
@@ -2,4 +2,3 @@
2
2
 
3
3
  # Add new mime types for use in respond_to blocks:
4
4
  # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,8 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
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
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,14 +1,14 @@
1
1
  # Be sure to restart your server when you modify this file.
2
- #
2
+
3
3
  # This file contains settings for ActionController::ParamsWrapper which
4
4
  # is enabled by default.
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
9
  end
10
10
 
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -1,5 +1,23 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
3
21
 
4
22
  en:
5
23
  hello: "Hello world"
@@ -1,19 +1,20 @@
1
- Dummy::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
1
+ Rails.application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
4
 
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
8
10
 
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
12
13
 
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
14
15
  # resources :products
15
16
 
16
- # Sample resource route with options:
17
+ # Example resource route with options:
17
18
  # resources :products do
18
19
  # member do
19
20
  # get 'short'
@@ -25,34 +26,31 @@ Dummy::Application.routes.draw do
25
26
  # end
26
27
  # end
27
28
 
28
- # Sample resource route with sub-resources:
29
+ # Example resource route with sub-resources:
29
30
  # resources :products do
30
31
  # resources :comments, :sales
31
32
  # resource :seller
32
33
  # end
33
34
 
34
- # Sample resource route with more complex sub-resources
35
+ # Example resource route with more complex sub-resources:
35
36
  # resources :products do
36
37
  # resources :comments
37
38
  # resources :sales do
38
- # get 'recent', :on => :collection
39
+ # get 'recent', on: :collection
39
40
  # end
40
41
  # end
41
42
 
42
- # Sample resource route within a namespace:
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
43
51
  # namespace :admin do
44
52
  # # Directs /admin/products/* to Admin::ProductsController
45
53
  # # (app/controllers/admin/products_controller.rb)
46
54
  # resources :products
47
55
  # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => 'welcome#index'
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id))(.:format)'
58
56
  end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: c9036e1915e8310a5647486371c65538e44289dcd79d1103db436f86b38b9a49bc89df0f5d1f8c3591e947e73d73932ffee2db43dc268886eb50a8d2a99ea9ad
15
+
16
+ test:
17
+ secret_key_base: ccae017f515d384bb5ae2f978fc5a1548fd8707640d78e5bb424769eb67a2cc480ed1dd807b198eb455719723a4651f5b2f8e883fb52d2a679cc2ea6301297c2
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Doan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '4.2'
27
27
  description: Caches ActiveRecord models for simple finds using the Rails low-level
28
28
  cache
29
29
  email:
@@ -41,6 +41,7 @@ files:
41
41
  - lib/activerecord_cache/base.rb
42
42
  - lib/activerecord_cache/belongs_to_association.rb
43
43
  - lib/activerecord_cache/belongs_to_preloader.rb
44
+ - lib/activerecord_cache/core.rb
44
45
  - lib/activerecord_cache/errors.rb
45
46
  - lib/activerecord_cache/finder_methods.rb
46
47
  - lib/activerecord_cache/railtie.rb
@@ -58,6 +59,10 @@ files:
58
59
  - test/dummy/app/models/cached_record.rb
59
60
  - test/dummy/app/models/non_primary_associated.rb
60
61
  - test/dummy/app/views/layouts/application.html.erb
62
+ - test/dummy/bin/bundle
63
+ - test/dummy/bin/rails
64
+ - test/dummy/bin/rake
65
+ - test/dummy/bin/setup
61
66
  - test/dummy/config.ru
62
67
  - test/dummy/config/application.rb
63
68
  - test/dummy/config/boot.rb
@@ -66,7 +71,10 @@ files:
66
71
  - test/dummy/config/environments/development.rb
67
72
  - test/dummy/config/environments/production.rb
68
73
  - test/dummy/config/environments/test.rb
74
+ - test/dummy/config/initializers/assets.rb
69
75
  - test/dummy/config/initializers/backtrace_silencers.rb
76
+ - test/dummy/config/initializers/cookies_serializer.rb
77
+ - test/dummy/config/initializers/filter_parameter_logging.rb
70
78
  - test/dummy/config/initializers/inflections.rb
71
79
  - test/dummy/config/initializers/mime_types.rb
72
80
  - test/dummy/config/initializers/secret_token.rb
@@ -74,6 +82,7 @@ files:
74
82
  - test/dummy/config/initializers/wrap_parameters.rb
75
83
  - test/dummy/config/locales/en.yml
76
84
  - test/dummy/config/routes.rb
85
+ - test/dummy/config/secrets.yml
77
86
  - test/dummy/db/development.sqlite3
78
87
  - test/dummy/db/migrate/20140715044034_create_cached_records.rb
79
88
  - test/dummy/db/migrate/20140715052133_create_associated_records.rb
@@ -114,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
123
  version: '0'
115
124
  requirements: []
116
125
  rubyforge_project:
117
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.4.5
118
127
  signing_key:
119
128
  specification_version: 4
120
129
  summary: A basic caching plugin for ActiveRecord