lookup_by 0.10.9 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +17 -9
  4. data/Appraisals +6 -6
  5. data/CHANGELOG.md +58 -0
  6. data/Gemfile +6 -10
  7. data/MIT-LICENSE +1 -1
  8. data/README.md +30 -27
  9. data/Rakefile +20 -2
  10. data/circle.yml +4 -2
  11. data/gemfiles/rails_6.0.gemfile +17 -0
  12. data/gemfiles/rails_6.1.gemfile +17 -0
  13. data/gemfiles/rails_7.0.gemfile +17 -0
  14. data/lib/lookup_by/association.rb +9 -3
  15. data/lib/lookup_by/cache.rb +17 -21
  16. data/lib/lookup_by/caching/safe_lru.rb +1 -1
  17. data/lib/lookup_by/hooks/formtastic.rb +2 -1
  18. data/lib/lookup_by/hooks/simple_form.rb +2 -1
  19. data/lib/lookup_by/lookup.rb +27 -13
  20. data/lib/lookup_by/version.rb +1 -1
  21. data/lib/lookup_by.rb +2 -0
  22. data/lookup_by.gemspec +2 -2
  23. data/spec/association_spec.rb +1 -0
  24. data/spec/cache_spec.rb +10 -0
  25. data/spec/{dummy → internal}/app/models/account.rb +0 -0
  26. data/spec/{dummy → internal}/app/models/address.rb +0 -0
  27. data/spec/{dummy → internal}/app/models/city.rb +0 -0
  28. data/spec/{dummy → internal}/app/models/country.rb +0 -0
  29. data/spec/{dummy → internal}/app/models/email_address.rb +0 -0
  30. data/spec/{dummy → internal}/app/models/ip_address.rb +0 -0
  31. data/spec/{dummy → internal}/app/models/path.rb +0 -0
  32. data/spec/{dummy → internal}/app/models/phone_number.rb +0 -0
  33. data/spec/{dummy → internal}/app/models/postal_code.rb +0 -0
  34. data/spec/{dummy → internal}/app/models/raisin.rb +0 -0
  35. data/spec/{dummy → internal}/app/models/read_through_raisin.rb +0 -0
  36. data/spec/{dummy → internal}/app/models/state.rb +0 -0
  37. data/spec/{dummy → internal}/app/models/status.rb +0 -0
  38. data/spec/{dummy → internal}/app/models/street.rb +0 -0
  39. data/spec/{dummy → internal}/app/models/uncacheable.rb +0 -0
  40. data/spec/{dummy → internal}/app/models/unfindable.rb +0 -0
  41. data/spec/{dummy → internal}/app/models/unsynchronizable.rb +0 -0
  42. data/spec/{dummy → internal}/app/models/user_agent.rb +0 -0
  43. data/spec/internal/config/database.yml +8 -0
  44. data/spec/internal/db/schema.rb +49 -0
  45. data/spec/{dummy → internal}/lib/missing.rb +0 -0
  46. data/spec/internal/log/.gitignore +1 -0
  47. data/spec/lookup_by_spec.rb +22 -6
  48. data/spec/rails_helper.rb +6 -13
  49. data/spec/support/shared_examples_for_a_lookup.rb +28 -7
  50. metadata +58 -94
  51. data/gemfiles/rails_4.0.gemfile +0 -22
  52. data/gemfiles/rails_4.1.gemfile +0 -22
  53. data/gemfiles/rails_4.2.gemfile +0 -22
  54. data/spec/dummy/Rakefile +0 -22
  55. data/spec/dummy/app/models/.gitkeep +0 -0
  56. data/spec/dummy/bin/bundle +0 -3
  57. data/spec/dummy/bin/rails +0 -4
  58. data/spec/dummy/bin/rake +0 -4
  59. data/spec/dummy/config/application.rb +0 -28
  60. data/spec/dummy/config/boot.rb +0 -6
  61. data/spec/dummy/config/database.yml +0 -44
  62. data/spec/dummy/config/environment.rb +0 -5
  63. data/spec/dummy/config/environments/development.rb +0 -20
  64. data/spec/dummy/config/environments/test.rb +0 -19
  65. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  66. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  67. data/spec/dummy/config/initializers/inflections.rb +0 -16
  68. data/spec/dummy/config/locales/en.yml +0 -23
  69. data/spec/dummy/config.ru +0 -4
  70. data/spec/dummy/db/migrate/20121019040009_create_tables.rb +0 -41
  71. data/spec/dummy/db/seeds.rb +0 -1
  72. data/spec/dummy/db/structure.sql +0 -1053
  73. data/spec/dummy/log/.gitkeep +0 -0
  74. data/spec/dummy/script/rails +0 -6
@@ -1,44 +0,0 @@
1
- # PostgreSQL. Versions 8.2 and up are supported.
2
- #
3
- # Install the pg driver:
4
- # gem install pg
5
- # On Mac OS X with macports:
6
- # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
7
- # On Windows:
8
- # gem install pg
9
- # Choose the win32 build.
10
- # Install PostgreSQL and put its /bin directory on your path.
11
- #
12
- # Configure Using Gemfile
13
- # gem 'pg'
14
- #
15
- development:
16
- adapter: postgresql
17
- encoding: unicode
18
- database: lookup_by_development
19
- pool: 5
20
- username: dummy
21
- password:
22
-
23
- # Connect on a TCP socket. Omitted by default since the client uses a
24
- # domain socket that doesn't need configuration. Windows does not have
25
- # domain sockets, so uncomment these lines.
26
- #host: localhost
27
- #port: 5432
28
-
29
- # Schema search path. The server defaults to $user,public
30
- #schema_search_path: myapp,sharedapp,public
31
-
32
- # Minimum log levels, in increasing order:
33
- # debug5, debug4, debug3, debug2, debug1,
34
- # log, notice, warning, error, fatal, and panic
35
- # The server defaults to notice.
36
- #min_messages: warning
37
-
38
- # Warning: The database defined as "test" will be erased and
39
- # re-generated from your development database when you run "rake".
40
- # Do not set this db to the same as development or production.
41
- test:
42
- adapter: postgresql
43
- database: lookup_by_test
44
- username: postgres
@@ -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,20 +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
-
15
- # Print deprecation notices to the Rails logger.
16
- config.active_support.deprecation = :log
17
-
18
- # Raise an error on page load if there are pending migrations
19
- config.active_record.migration_error = :page_load
20
- end
@@ -1,19 +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
- # 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
- config.eager_load_paths = []
15
-
16
- if config.active_support.respond_to?(:deprecation=)
17
- config.active_support.deprecation = :stderr
18
- end
19
- end
@@ -1,7 +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 to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,4 +0,0 @@
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,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
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|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,23 +0,0 @@
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.
21
-
22
- en:
23
- hello: "Hello world"
data/spec/dummy/config.ru DELETED
@@ -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,41 +0,0 @@
1
- class CreateTables < ActiveRecord::Migration
2
- def up
3
- create_lookup_tables :cities, :states, :postal_codes, :streets, :countries
4
-
5
- create_lookup_table :user_agents
6
- create_lookup_table :email_addresses
7
-
8
-
9
- create_lookup_table :statuses, small: true
10
-
11
- create_lookup_table :ip_addresses, lookup_type: :inet
12
-
13
- create_lookup_table :phone_numbers
14
-
15
- create_lookup_table :uncacheables
16
- create_lookup_table :unfindables
17
-
18
- create_lookup_table :raisins
19
- create_lookup_table :read_through_raisins
20
-
21
- create_lookup_table :unsynchronizables
22
-
23
- enable_extension 'uuid-ossp'
24
-
25
- execute 'CREATE SCHEMA traffic;'
26
-
27
- create_lookup_table :paths, schema: 'traffic', id: :uuid
28
-
29
- create_lookup_table :accounts do |t|
30
- t.belongs_to :phone_number
31
- end
32
-
33
- create_lookup_table :addresses do |t|
34
- t.belongs_to :city
35
- t.belongs_to :state
36
- t.belongs_to :postal_code
37
- t.belongs_to :street
38
- t.belongs_to :country
39
- end
40
- end
41
- end
@@ -1 +0,0 @@
1
- State.create(name: 'AL')