join_cache 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/README.markdown +33 -2
  2. data/VERSION +1 -1
  3. data/join_cache.gemspec +65 -4
  4. data/lib/join_cache.rb +2 -6
  5. data/test/dummy/.gitignore +16 -0
  6. data/test/dummy/.rspec +1 -0
  7. data/test/dummy/Gemfile +9 -0
  8. data/test/dummy/Gemfile.lock +101 -0
  9. data/test/dummy/README.rdoc +28 -0
  10. data/test/dummy/Rakefile +6 -0
  11. data/test/dummy/app/assets/images/.keep +0 -0
  12. data/test/dummy/app/assets/javascripts/application.js +16 -0
  13. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  14. data/test/dummy/app/controllers/application_controller.rb +5 -0
  15. data/test/dummy/app/controllers/concerns/.keep +0 -0
  16. data/test/dummy/app/helpers/application_helper.rb +2 -0
  17. data/test/dummy/app/mailers/.keep +0 -0
  18. data/test/dummy/app/models/.keep +0 -0
  19. data/test/dummy/app/models/appointment.rb +4 -0
  20. data/test/dummy/app/models/assemblies_parts.rb +4 -0
  21. data/test/dummy/app/models/assembly.rb +4 -0
  22. data/test/dummy/app/models/concerns/.keep +0 -0
  23. data/test/dummy/app/models/part.rb +4 -0
  24. data/test/dummy/app/models/patient.rb +5 -0
  25. data/test/dummy/app/models/physician.rb +5 -0
  26. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/test/dummy/bin/bundle +3 -0
  28. data/test/dummy/bin/rails +4 -0
  29. data/test/dummy/bin/rake +4 -0
  30. data/test/dummy/config/application.rb +23 -0
  31. data/test/dummy/config/boot.rb +4 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +5 -0
  34. data/test/dummy/config/environments/development.rb +29 -0
  35. data/test/dummy/config/environments/production.rb +80 -0
  36. data/test/dummy/config/environments/test.rb +36 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/test/dummy/config/initializers/inflections.rb +16 -0
  40. data/test/dummy/config/initializers/mime_types.rb +5 -0
  41. data/test/dummy/config/initializers/secret_token.rb +12 -0
  42. data/test/dummy/config/initializers/session_store.rb +3 -0
  43. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  44. data/test/dummy/config/locales/en.yml +23 -0
  45. data/test/dummy/config/routes.rb +56 -0
  46. data/test/dummy/config.ru +4 -0
  47. data/test/dummy/db/migrate/20131022000628_create_physicians.rb +9 -0
  48. data/test/dummy/db/migrate/20131022000639_create_patients.rb +9 -0
  49. data/test/dummy/db/migrate/20131022000722_create_appointments.rb +10 -0
  50. data/test/dummy/db/migrate/20131022011147_create_assemblies.rb +9 -0
  51. data/test/dummy/db/migrate/20131022011202_create_parts.rb +9 -0
  52. data/test/dummy/db/migrate/20131022011217_create_assemblies_parts.rb +8 -0
  53. data/test/dummy/db/schema.rb +58 -0
  54. data/test/dummy/db/seeds.rb +7 -0
  55. data/test/dummy/lib/assets/.keep +0 -0
  56. data/test/dummy/lib/tasks/.keep +0 -0
  57. data/test/dummy/log/.keep +0 -0
  58. data/test/dummy/public/404.html +58 -0
  59. data/test/dummy/public/422.html +58 -0
  60. data/test/dummy/public/500.html +57 -0
  61. data/test/dummy/public/favicon.ico +0 -0
  62. data/test/dummy/public/robots.txt +5 -0
  63. data/test/dummy/spec/models/has_and_belongs_to_many_spec.rb +23 -0
  64. data/test/dummy/spec/models/has_many_through_spec.rb +23 -0
  65. data/test/dummy/spec/spec_helper.rb +42 -0
  66. data/test/dummy/vendor/assets/javascripts/.keep +0 -0
  67. data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
  68. metadata +66 -5
  69. data/test/helper.rb +0 -18
  70. data/test/test_join_cache.rb +0 -7
data/README.markdown CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Faster ActiveRecord associations using Rails cache.
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/join_cache.png)](http://badge.fury.io/rb/join_cache)
6
+
5
7
  ## What?
6
8
 
7
9
  Let's say you scaffolded your Rails app and ended up with this:
@@ -16,7 +18,7 @@ Retrieving the teams of one employee generates an inner join:
16
18
 
17
19
  ```ruby
18
20
  bob.teams
19
- Team Load SELECT "teams".* FROM "teams" INNER JOIN "employees_teams" ON "teams"."id" = "employees_teams"."team_id" WHERE "employees_teams"."employee_id" = ? [["employee_id", 1]]
21
+ => Team Load SELECT "teams".* FROM "teams" INNER JOIN "employees_teams" ON "teams"."id" = "employees_teams"."team_id" WHERE "employees_teams"."employee_id" = ? [["employee_id", 1]]
20
22
  ```
21
23
 
22
24
  The gem join_cache generates methods to store the team ids in cache:
@@ -35,7 +37,7 @@ bob.cached_teams
35
37
  In your gemfile:
36
38
 
37
39
  ```ruby
38
- gem 'joined_table'
40
+ gem 'join_cache'
39
41
  ```
40
42
 
41
43
  In your model:
@@ -49,6 +51,35 @@ end
49
51
 
50
52
  It also works with `has_many :through` associations!
51
53
 
54
+ ```ruby
55
+ class Physician < ActiveRecord::Base
56
+ has_many :appointments
57
+ has_many :patients, through: :appointments
58
+ include JoinCache
59
+ end
60
+
61
+ freud.patients
62
+ => Patient Load SELECT "patients".* FROM "patients" INNER JOIN "appointments" ON "patients"."id" = "appointments"."patient_id" WHERE "appointments"."physician_id" = ? [["physician_id", 1]]
63
+
64
+ freud.cached_patient_ids
65
+ => [4, 8, 15, 16, 23, 42]
66
+
67
+ freud.cached_patients
68
+ => Patient.where(id: [4, 8, 15, 16, 23, 42])
69
+ => Patient Load SELECT "patients".* FROM "patients" WHERE "patients"."id" IN (4, 8, 15, 16, 23, 42)
70
+ ```
71
+
72
+ Take a look at this [example app](https://github.com/KevinBongart/join_cache_example).
73
+
74
+ ## Performance
75
+
76
+ I ran [a very scientific study](http://i0.kym-cdn.com/photos/images/original/000/234/765/b7e.jpg) using Heroku, PostgreSQL, the [example app](https://github.com/KevinBongart/join_cache_example), its seeds.rb and speed.rake files.
77
+ Shorter means better:
78
+
79
+ ![](http://f.cl.ly/items/3j0N0Y3j3d3B352x3009/screenshot%20320.png)
80
+
81
+ See? 30% faster!
82
+
52
83
  ## TODO
53
84
 
54
85
  * [Support callbacks: after_add and after_remove](https://github.com/KevinBongart/join_cache/issues/2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/join_cache.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "join_cache"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kevin Bongart"]
12
- s.date = "2013-10-17"
12
+ s.date = "2013-10-22"
13
13
  s.email = "contact@kevinbongart.net"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -25,8 +25,69 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "join_cache.gemspec",
27
27
  "lib/join_cache.rb",
28
- "test/helper.rb",
29
- "test/test_join_cache.rb"
28
+ "test/dummy/.gitignore",
29
+ "test/dummy/.rspec",
30
+ "test/dummy/Gemfile",
31
+ "test/dummy/Gemfile.lock",
32
+ "test/dummy/README.rdoc",
33
+ "test/dummy/Rakefile",
34
+ "test/dummy/app/assets/images/.keep",
35
+ "test/dummy/app/assets/javascripts/application.js",
36
+ "test/dummy/app/assets/stylesheets/application.css",
37
+ "test/dummy/app/controllers/application_controller.rb",
38
+ "test/dummy/app/controllers/concerns/.keep",
39
+ "test/dummy/app/helpers/application_helper.rb",
40
+ "test/dummy/app/mailers/.keep",
41
+ "test/dummy/app/models/.keep",
42
+ "test/dummy/app/models/appointment.rb",
43
+ "test/dummy/app/models/assemblies_parts.rb",
44
+ "test/dummy/app/models/assembly.rb",
45
+ "test/dummy/app/models/concerns/.keep",
46
+ "test/dummy/app/models/part.rb",
47
+ "test/dummy/app/models/patient.rb",
48
+ "test/dummy/app/models/physician.rb",
49
+ "test/dummy/app/views/layouts/application.html.erb",
50
+ "test/dummy/bin/bundle",
51
+ "test/dummy/bin/rails",
52
+ "test/dummy/bin/rake",
53
+ "test/dummy/config.ru",
54
+ "test/dummy/config/application.rb",
55
+ "test/dummy/config/boot.rb",
56
+ "test/dummy/config/database.yml",
57
+ "test/dummy/config/environment.rb",
58
+ "test/dummy/config/environments/development.rb",
59
+ "test/dummy/config/environments/production.rb",
60
+ "test/dummy/config/environments/test.rb",
61
+ "test/dummy/config/initializers/backtrace_silencers.rb",
62
+ "test/dummy/config/initializers/filter_parameter_logging.rb",
63
+ "test/dummy/config/initializers/inflections.rb",
64
+ "test/dummy/config/initializers/mime_types.rb",
65
+ "test/dummy/config/initializers/secret_token.rb",
66
+ "test/dummy/config/initializers/session_store.rb",
67
+ "test/dummy/config/initializers/wrap_parameters.rb",
68
+ "test/dummy/config/locales/en.yml",
69
+ "test/dummy/config/routes.rb",
70
+ "test/dummy/db/migrate/20131022000628_create_physicians.rb",
71
+ "test/dummy/db/migrate/20131022000639_create_patients.rb",
72
+ "test/dummy/db/migrate/20131022000722_create_appointments.rb",
73
+ "test/dummy/db/migrate/20131022011147_create_assemblies.rb",
74
+ "test/dummy/db/migrate/20131022011202_create_parts.rb",
75
+ "test/dummy/db/migrate/20131022011217_create_assemblies_parts.rb",
76
+ "test/dummy/db/schema.rb",
77
+ "test/dummy/db/seeds.rb",
78
+ "test/dummy/lib/assets/.keep",
79
+ "test/dummy/lib/tasks/.keep",
80
+ "test/dummy/log/.keep",
81
+ "test/dummy/public/404.html",
82
+ "test/dummy/public/422.html",
83
+ "test/dummy/public/500.html",
84
+ "test/dummy/public/favicon.ico",
85
+ "test/dummy/public/robots.txt",
86
+ "test/dummy/spec/models/has_and_belongs_to_many_spec.rb",
87
+ "test/dummy/spec/models/has_many_through_spec.rb",
88
+ "test/dummy/spec/spec_helper.rb",
89
+ "test/dummy/vendor/assets/javascripts/.keep",
90
+ "test/dummy/vendor/assets/stylesheets/.keep"
30
91
  ]
31
92
  s.homepage = "http://github.com/KevinBongart/join_cache"
32
93
  s.licenses = ["MIT"]
data/lib/join_cache.rb CHANGED
@@ -24,13 +24,11 @@ module JoinCache
24
24
  cached_ids_name = "cached_#{singular_name}_ids" # cached_team_ids
25
25
  primary_key = association.foreign_key # employee_id
26
26
  foreign_key = association.association_foreign_key # team_id
27
- join_table = association.join_table # employees_teams
28
- join_model = join_table.classify.pluralize.constantize # EmployeesTeams
29
27
 
30
28
  # cached_team_ids
31
29
  define_method(cached_ids_name) do
32
30
  Rails.cache.fetch("#{cache_key}/#{cached_ids_name}") do
33
- join_model.where(primary_key => id).pluck(foreign_key.to_sym)
31
+ send(foreign_key.pluralize.to_sym)
34
32
  end
35
33
  end
36
34
 
@@ -67,13 +65,11 @@ module JoinCache
67
65
  cached_ids_name = "cached_#{singular_name}_ids" # cached_patient_ids
68
66
  primary_key = self.name.foreign_key # employee_id
69
67
  foreign_key = association.foreign_key # patient_id
70
- join_table = association.options[:through] # appointments
71
- join_model = join_table.to_s.classify.constantize # Appointment
72
68
 
73
69
  # cached_patient_ids
74
70
  define_method(cached_ids_name) do
75
71
  Rails.cache.fetch("#{cache_key}/#{cached_ids_name}") do
76
- join_model.where(primary_key => id).pluck(foreign_key.to_sym)
72
+ send(foreign_key.pluralize.to_sym)
77
73
  end
78
74
  end
79
75
 
@@ -0,0 +1,16 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*.log
16
+ /tmp
data/test/dummy/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '4.0.0'
4
+ gem 'sqlite3'
5
+ gem 'join_cache', path: '../..'
6
+
7
+ group :development, :test do
8
+ gem 'rspec-rails', '~> 2.0'
9
+ end
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: ../../../join_cache
3
+ specs:
4
+ join_cache (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.0.0)
10
+ actionpack (= 4.0.0)
11
+ mail (~> 2.5.3)
12
+ actionpack (4.0.0)
13
+ activesupport (= 4.0.0)
14
+ builder (~> 3.1.0)
15
+ erubis (~> 2.7.0)
16
+ rack (~> 1.5.2)
17
+ rack-test (~> 0.6.2)
18
+ activemodel (4.0.0)
19
+ activesupport (= 4.0.0)
20
+ builder (~> 3.1.0)
21
+ activerecord (4.0.0)
22
+ activemodel (= 4.0.0)
23
+ activerecord-deprecated_finders (~> 1.0.2)
24
+ activesupport (= 4.0.0)
25
+ arel (~> 4.0.0)
26
+ activerecord-deprecated_finders (1.0.3)
27
+ activesupport (4.0.0)
28
+ i18n (~> 0.6, >= 0.6.4)
29
+ minitest (~> 4.2)
30
+ multi_json (~> 1.3)
31
+ thread_safe (~> 0.1)
32
+ tzinfo (~> 0.3.37)
33
+ arel (4.0.0)
34
+ atomic (1.1.14)
35
+ builder (3.1.4)
36
+ diff-lcs (1.2.4)
37
+ erubis (2.7.0)
38
+ hike (1.2.3)
39
+ i18n (0.6.5)
40
+ mail (2.5.4)
41
+ mime-types (~> 1.16)
42
+ treetop (~> 1.4.8)
43
+ mime-types (1.25)
44
+ minitest (4.7.5)
45
+ multi_json (1.8.2)
46
+ polyglot (0.3.3)
47
+ rack (1.5.2)
48
+ rack-test (0.6.2)
49
+ rack (>= 1.0)
50
+ rails (4.0.0)
51
+ actionmailer (= 4.0.0)
52
+ actionpack (= 4.0.0)
53
+ activerecord (= 4.0.0)
54
+ activesupport (= 4.0.0)
55
+ bundler (>= 1.3.0, < 2.0)
56
+ railties (= 4.0.0)
57
+ sprockets-rails (~> 2.0.0)
58
+ railties (4.0.0)
59
+ actionpack (= 4.0.0)
60
+ activesupport (= 4.0.0)
61
+ rake (>= 0.8.7)
62
+ thor (>= 0.18.1, < 2.0)
63
+ rake (10.1.0)
64
+ rspec-core (2.14.6)
65
+ rspec-expectations (2.14.3)
66
+ diff-lcs (>= 1.1.3, < 2.0)
67
+ rspec-mocks (2.14.4)
68
+ rspec-rails (2.14.0)
69
+ actionpack (>= 3.0)
70
+ activesupport (>= 3.0)
71
+ railties (>= 3.0)
72
+ rspec-core (~> 2.14.0)
73
+ rspec-expectations (~> 2.14.0)
74
+ rspec-mocks (~> 2.14.0)
75
+ sprockets (2.10.0)
76
+ hike (~> 1.2)
77
+ multi_json (~> 1.0)
78
+ rack (~> 1.0)
79
+ tilt (~> 1.1, != 1.3.0)
80
+ sprockets-rails (2.0.1)
81
+ actionpack (>= 3.0)
82
+ activesupport (>= 3.0)
83
+ sprockets (~> 2.8)
84
+ sqlite3 (1.3.8)
85
+ thor (0.18.1)
86
+ thread_safe (0.1.3)
87
+ atomic
88
+ tilt (1.4.1)
89
+ treetop (1.4.15)
90
+ polyglot
91
+ polyglot (>= 0.3.1)
92
+ tzinfo (0.3.38)
93
+
94
+ PLATFORMS
95
+ ruby
96
+
97
+ DEPENDENCIES
98
+ join_cache!
99
+ rails (= 4.0.0)
100
+ rspec-rails (~> 2.0)
101
+ sqlite3
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
File without changes
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ class Appointment < ActiveRecord::Base
2
+ belongs_to :physician
3
+ belongs_to :patient
4
+ end
@@ -0,0 +1,4 @@
1
+ class AssembliesParts < ActiveRecord::Base
2
+ belongs_to :assembly
3
+ belongs_to :part
4
+ end
@@ -0,0 +1,4 @@
1
+ class Assembly < ActiveRecord::Base
2
+ has_and_belongs_to_many :parts
3
+ include JoinCache
4
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ class Part < ActiveRecord::Base
2
+ has_and_belongs_to_many :parts
3
+ include JoinCache
4
+ end
@@ -0,0 +1,5 @@
1
+ class Patient < ActiveRecord::Base
2
+ has_many :appointments
3
+ has_many :physicians, through: :appointments
4
+ include JoinCache
5
+ end
@@ -0,0 +1,5 @@
1
+ class Physician < ActiveRecord::Base
2
+ has_many :appointments
3
+ has_many :patients, through: :appointments
4
+ include JoinCache
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -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,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -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,29 @@
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
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
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
29
+ end
@@ -0,0 +1,80 @@
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
+ # 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 nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end