wor-simple_crud 0.2.1

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 (86) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +52 -0
  3. data/.gitignore +338 -0
  4. data/.overcommit.yml +15 -0
  5. data/.rubocop.yml +16 -0
  6. data/Appraisals +40 -0
  7. data/CHANGELOG.md +12 -0
  8. data/Gemfile +42 -0
  9. data/LICENSE.md +22 -0
  10. data/README.md +286 -0
  11. data/Rakefile +6 -0
  12. data/lib/simple_crud/authorization/action_policy_adapter.rb +22 -0
  13. data/lib/simple_crud/authorization/adapter.rb +20 -0
  14. data/lib/simple_crud/authorization/can_can_can_adapter.rb +22 -0
  15. data/lib/simple_crud/authorization/pundit_adapter.rb +21 -0
  16. data/lib/simple_crud/config.rb +24 -0
  17. data/lib/simple_crud/pagination/adapter.rb +14 -0
  18. data/lib/simple_crud/pagination/kaminari_adapter.rb +19 -0
  19. data/lib/simple_crud/pagination/pagy_adapter.rb +22 -0
  20. data/lib/simple_crud/pagination/will_paginate_adapter.rb +22 -0
  21. data/lib/simple_crud/pagination/wor_paginate_adapter.rb +17 -0
  22. data/lib/simple_crud/rspec.rb +11 -0
  23. data/lib/simple_crud/simple_crud_controller.rb +125 -0
  24. data/lib/simple_crud/version.rb +5 -0
  25. data/lib/simple_crud.rb +12 -0
  26. data/lib/spec/matchers/have_been_serialized_with.rb +30 -0
  27. data/lib/spec/response_helper.rb +10 -0
  28. data/lib/spec/shared_contexts/authenticate_user.rb +11 -0
  29. data/lib/spec/shared_examples/helpers.rb +50 -0
  30. data/lib/spec/shared_examples/simple_crud_for_create.rb +49 -0
  31. data/lib/spec/shared_examples/simple_crud_for_destroy.rb +68 -0
  32. data/lib/spec/shared_examples/simple_crud_for_index.rb +56 -0
  33. data/lib/spec/shared_examples/simple_crud_for_show.rb +51 -0
  34. data/lib/spec/shared_examples/simple_crud_for_update.rb +61 -0
  35. data/lib/spec/shared_examples/unauthorized_when_not_logged_in.rb +10 -0
  36. data/pull_request_template.md +3 -0
  37. data/spec/dummy/Rakefile +8 -0
  38. data/spec/dummy/app/assets/config/manifest.js +6 -0
  39. data/spec/dummy/app/controllers/application_controller.rb +38 -0
  40. data/spec/dummy/app/controllers/dummy_models_controller.rb +23 -0
  41. data/spec/dummy/app/controllers/without_pagination/dummy_models_controller.rb +15 -0
  42. data/spec/dummy/app/models/application_record.rb +5 -0
  43. data/spec/dummy/app/models/concerns/.keep +0 -0
  44. data/spec/dummy/app/models/dummy_model.rb +7 -0
  45. data/spec/dummy/app/models/dummy_model_policy.rb +34 -0
  46. data/spec/dummy/app/models/user.rb +11 -0
  47. data/spec/dummy/app/serializers/dummy_model_serializer.rb +5 -0
  48. data/spec/dummy/bin/bundle +5 -0
  49. data/spec/dummy/bin/rails +6 -0
  50. data/spec/dummy/bin/rake +6 -0
  51. data/spec/dummy/bin/setup +35 -0
  52. data/spec/dummy/bin/update +30 -0
  53. data/spec/dummy/config/application.rb +17 -0
  54. data/spec/dummy/config/boot.rb +10 -0
  55. data/spec/dummy/config/database.yml +25 -0
  56. data/spec/dummy/config/environment.rb +7 -0
  57. data/spec/dummy/config/environments/development.rb +46 -0
  58. data/spec/dummy/config/environments/test.rb +47 -0
  59. data/spec/dummy/config/initializers/devise.rb +303 -0
  60. data/spec/dummy/config/locales/devise.en.yml +65 -0
  61. data/spec/dummy/config/puma.rb +49 -0
  62. data/spec/dummy/config/routes.rb +10 -0
  63. data/spec/dummy/config/secrets.yml +22 -0
  64. data/spec/dummy/config/spring.rb +8 -0
  65. data/spec/dummy/config.ru +7 -0
  66. data/spec/dummy/db/migrate/20170626184159_create_dummy_models.rb +10 -0
  67. data/spec/dummy/db/migrate/20200110191019_devise_create_users.rb +43 -0
  68. data/spec/dummy/db/migrate/20200120165657_add_user_id_to_dummy_models.rb +7 -0
  69. data/spec/dummy/db/schema.rb +36 -0
  70. data/spec/dummy/lib/assets/.keep +0 -0
  71. data/spec/dummy/log/.keep +0 -0
  72. data/spec/dummy/spec/factories/dummy_models.rb +9 -0
  73. data/spec/dummy/spec/factories/users.rb +8 -0
  74. data/spec/dummy_controller_spec.rb +19 -0
  75. data/spec/dummy_model_policy_spec.rb +29 -0
  76. data/spec/dummy_model_serializer_spec.rb +36 -0
  77. data/spec/simple_crud/authorization/action_policy_adapter_spec.rb +58 -0
  78. data/spec/simple_crud/authorization/can_can_can_adapter_spec.rb +53 -0
  79. data/spec/simple_crud/pagination/adapters_spec.rb +48 -0
  80. data/spec/simple_crud_configuration_spec.rb +61 -0
  81. data/spec/simple_crud_controller_spec.rb +41 -0
  82. data/spec/spec_helper.rb +60 -0
  83. data/spec/spy.rb +41 -0
  84. data/spec/without_pagination/dummy_models_controller_spec.rb +6 -0
  85. data/wor-simple_crud.gemspec +23 -0
  86. metadata +145 -0
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails/all'
6
+
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ config.load_defaults 6.1
12
+
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration should go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded.
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Ruby 3.4+ no longer auto-loads logger, which older Rails versions assume.
4
+ require 'logger'
5
+
6
+ # Set up gems listed in the Gemfile.
7
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
8
+
9
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -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
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded on
7
+ # every request. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ config.action_controller.perform_caching = false
18
+
19
+ config.cache_store = :null_store
20
+
21
+ # Don't care if the mailer can't send.
22
+ config.action_mailer.raise_delivery_errors = false
23
+
24
+ config.action_mailer.perform_caching = false
25
+
26
+ # Print deprecation notices to the Rails logger.
27
+ config.active_support.deprecation = :log
28
+
29
+ # Raise an error on page load if there are pending migrations.
30
+ config.active_record.migration_error = :page_load
31
+
32
+ # Debug mode disables concatenation and preprocessing of assets.
33
+ # This option may cause significant delays in view rendering with a large
34
+ # number of complex assets.
35
+ config.assets.debug = true
36
+
37
+ # Suppress logger output for asset requests.
38
+ config.assets.quiet = true
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ # Use an evented file watcher to asynchronously detect changes in source code,
44
+ # routes, locales, etc. This feature depends on the listen gem.
45
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
46
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # The test environment is used exclusively to run your application's
7
+ # test suite. You never need to work with it otherwise. Remember that
8
+ # your test database is "scratch space" for the test suite and is wiped
9
+ # and recreated between test runs. Don't rely on the data there!
10
+ config.cache_classes = true
11
+
12
+ # Do not eager load code on boot. This avoids loading your whole application
13
+ # just for the purpose of running a single test. If you are using a tool that
14
+ # preloads Rails for running tests, you may have to set it to true.
15
+ config.eager_load = false
16
+
17
+ # Configure public file server for tests with Cache-Control for performance.
18
+ config.public_file_server.enabled = true
19
+ config.public_file_server.headers = {
20
+ 'Cache-Control' => 'public, max-age=3600'
21
+ }
22
+
23
+ # Show full error reports and disable caching.
24
+ config.consider_all_requests_local = true
25
+ config.action_controller.perform_caching = false
26
+
27
+ # Raise exceptions instead of rendering exception templates.
28
+ config.action_dispatch.show_exceptions = false
29
+
30
+ # Disable request forgery protection in test environment.
31
+ config.action_controller.allow_forgery_protection = false
32
+ config.action_mailer.perform_caching = false
33
+
34
+ # Tell Action Mailer not to deliver emails to the real world.
35
+ # The :test delivery method accumulates sent emails in the
36
+ # ActionMailer::Base.deliveries array.
37
+ config.action_mailer.delivery_method = :test
38
+
39
+ # Print deprecation notices to the stderr.
40
+ config.active_support.deprecation = :stderr
41
+
42
+ # Raises error for missing translations
43
+ # config.action_view.raise_on_missing_translations = true
44
+
45
+ # Whitelists all hosts on test enviroment. Fix for rails 6
46
+ config.hosts.clear if Rails::VERSION::MAJOR >= 6
47
+ end
@@ -0,0 +1,303 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Use this hook to configure devise mailer, warden hooks and so forth.
4
+ # Many of these configuration options can be set straight in your model.
5
+ Devise.setup do |config|
6
+ # The secret key used by Devise. Devise uses this key to generate
7
+ # random tokens. Changing this key will render invalid all existing
8
+ # confirmation, reset password and unlock tokens in the database.
9
+ # Devise will use the `secret_key_base` as its `secret_key`
10
+ # by default. You can change it below and use your own secret key.
11
+ # config.secret_key = 'f05e6c746606214db2ed264a8c9bfbd8aad8b0b85e709fa1077cf079e04033994f30fc'
12
+
13
+ # ==> Controller configuration
14
+ # Configure the parent class to the devise controllers.
15
+ # config.parent_controller = 'DeviseController'
16
+
17
+ # ==> Mailer Configuration
18
+ # Configure the e-mail address which will be shown in Devise::Mailer,
19
+ # note that it will be overwritten if you use your own mailer class
20
+ # with default "from" parameter.
21
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
22
+
23
+ # Configure the class responsible to send e-mails.
24
+ # config.mailer = 'Devise::Mailer'
25
+
26
+ # Configure the parent class responsible to send e-mails.
27
+ # config.parent_mailer = 'ActionMailer::Base'
28
+
29
+ # ==> ORM configuration
30
+ # Load and configure the ORM. Supports :active_record (default) and
31
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
32
+ # available as additional gems.
33
+ require 'devise/orm/active_record'
34
+
35
+ # ==> Configuration for any authentication mechanism
36
+ # Configure which keys are used when authenticating a user. The default is
37
+ # just :email. You can configure it to use [:username, :subdomain], so for
38
+ # authenticating a user, both parameters are required. Remember that those
39
+ # parameters are used only when authenticating and not when retrieving from
40
+ # session. If you need permissions, you should implement that in a before filter.
41
+ # You can also supply a hash where the value is a boolean determining whether
42
+ # or not authentication should be aborted when the value is not present.
43
+ # config.authentication_keys = [:email]
44
+
45
+ # Configure parameters from the request object used for authentication. Each entry
46
+ # given should be a request method and it will automatically be passed to the
47
+ # find_for_authentication method and considered in your model lookup. For instance,
48
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
49
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
50
+ # config.request_keys = []
51
+
52
+ # Configure which authentication keys should be case-insensitive.
53
+ # These keys will be downcased upon creating or modifying a user and when used
54
+ # to authenticate or find a user. Default is :email.
55
+ config.case_insensitive_keys = [:email]
56
+
57
+ # Configure which authentication keys should have whitespace stripped.
58
+ # These keys will have whitespace before and after removed upon creating or
59
+ # modifying a user and when used to authenticate or find a user. Default is :email.
60
+ config.strip_whitespace_keys = [:email]
61
+
62
+ # Tell if authentication through request.params is enabled. True by default.
63
+ # It can be set to an array that will enable params authentication only for the
64
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
65
+ # enable it only for database (email + password) authentication.
66
+ # config.params_authenticatable = true
67
+
68
+ # Tell if authentication through HTTP Auth is enabled. False by default.
69
+ # It can be set to an array that will enable http authentication only for the
70
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
71
+ # enable it only for database authentication. The supported strategies are:
72
+ # :database = Support basic authentication with authentication key + password
73
+ # config.http_authenticatable = false
74
+
75
+ # If 401 status code should be returned for AJAX requests. True by default.
76
+ # config.http_authenticatable_on_xhr = true
77
+
78
+ # The realm used in Http Basic Authentication. 'Application' by default.
79
+ # config.http_authentication_realm = 'Application'
80
+
81
+ # It will change confirmation, password recovery and other workflows
82
+ # to behave the same regardless if the e-mail provided was right or wrong.
83
+ # Does not affect registerable.
84
+ # config.paranoid = true
85
+
86
+ # By default Devise will store the user in session. You can skip storage for
87
+ # particular strategies by setting this option.
88
+ # Notice that if you are skipping storage for all authentication paths, you
89
+ # may want to disable generating routes to Devise's sessions controller by
90
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
91
+ config.skip_session_storage = [:http_auth]
92
+
93
+ # By default, Devise cleans up the CSRF token on authentication to
94
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
95
+ # requests for sign in and sign up, you need to get a new CSRF token
96
+ # from the server. You can disable this option at your own risk.
97
+ # config.clean_up_csrf_token_on_authentication = true
98
+
99
+ # When false, Devise will not attempt to reload routes on eager load.
100
+ # This can reduce the time taken to boot the app but if your application
101
+ # requires the Devise mappings to be loaded during boot time the application
102
+ # won't boot properly.
103
+ # config.reload_routes = true
104
+
105
+ # ==> Configuration for :database_authenticatable
106
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107
+ # using other algorithms, it sets how many times you want the password to be hashed.
108
+ #
109
+ # Limiting the stretches to just one in testing will increase the performance of
110
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
112
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
113
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114
+ config.stretches = Rails.env.test? ? 1 : 11
115
+
116
+ # Set up a pepper to generate the hashed password.
117
+ # config.pepper = 'c25e615d58ee60500efeff6cadba59195f0de7fe747be2af41890dec0a31ba6295e920be'
118
+
119
+ # Send a notification to the original email when the user's email is changed.
120
+ # config.send_email_changed_notification = false
121
+
122
+ # Send a notification email when the user's password is changed.
123
+ # config.send_password_change_notification = false
124
+
125
+ # ==> Configuration for :confirmable
126
+ # A period that the user is allowed to access the website even without
127
+ # confirming their account. For instance, if set to 2.days, the user will be
128
+ # able to access the website for two days without confirming their account,
129
+ # access will be blocked just in the third day.
130
+ # You can also set it to nil, which will allow the user to access the website
131
+ # without confirming their account.
132
+ # Default is 0.days, meaning the user cannot access the website without
133
+ # confirming their account.
134
+ # config.allow_unconfirmed_access_for = 2.days
135
+
136
+ # A period that the user is allowed to confirm their account before their
137
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
138
+ # their account within 3 days after the mail was sent, but on the fourth day
139
+ # their account can't be confirmed with the token any more.
140
+ # Default is nil, meaning there is no restriction on how long a user can take
141
+ # before confirming their account.
142
+ # config.confirm_within = 3.days
143
+
144
+ # If true, requires any email changes to be confirmed (exactly the same way as
145
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
146
+ # db field (see migrations). Until confirmed, new email is stored in
147
+ # unconfirmed_email column, and copied to email column on successful confirmation.
148
+ config.reconfirmable = true
149
+
150
+ # Defines which key will be used when confirming an account
151
+ # config.confirmation_keys = [:email]
152
+
153
+ # ==> Configuration for :rememberable
154
+ # The time the user will be remembered without asking for credentials again.
155
+ # config.remember_for = 2.weeks
156
+
157
+ # Invalidates all the remember me tokens when the user signs out.
158
+ config.expire_all_remember_me_on_sign_out = true
159
+
160
+ # If true, extends the user's remember period when remembered via cookie.
161
+ # config.extend_remember_period = false
162
+
163
+ # Options to be passed to the created cookie. For instance, you can set
164
+ # secure: true in order to force SSL only cookies.
165
+ # config.rememberable_options = {}
166
+
167
+ # ==> Configuration for :validatable
168
+ # Range for password length.
169
+ config.password_length = 6..128
170
+
171
+ # Email regex used to validate email formats. It simply asserts that
172
+ # one (and only one) @ exists in the given string. This is mainly
173
+ # to give user feedback and not to assert the e-mail validity.
174
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
175
+
176
+ # ==> Configuration for :timeoutable
177
+ # The time you want to timeout the user session without activity. After this
178
+ # time the user will be asked for credentials again. Default is 30 minutes.
179
+ # config.timeout_in = 30.minutes
180
+
181
+ # ==> Configuration for :lockable
182
+ # Defines which strategy will be used to lock an account.
183
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
184
+ # :none = No lock strategy. You should handle locking by yourself.
185
+ # config.lock_strategy = :failed_attempts
186
+
187
+ # Defines which key will be used when locking and unlocking an account
188
+ # config.unlock_keys = [:email]
189
+
190
+ # Defines which strategy will be used to unlock an account.
191
+ # :email = Sends an unlock link to the user email
192
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
193
+ # :both = Enables both strategies
194
+ # :none = No unlock strategy. You should handle unlocking by yourself.
195
+ # config.unlock_strategy = :both
196
+
197
+ # Number of authentication tries before locking an account if lock_strategy
198
+ # is failed attempts.
199
+ # config.maximum_attempts = 20
200
+
201
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
202
+ # config.unlock_in = 1.hour
203
+
204
+ # Warn on the last attempt before the account is locked.
205
+ # config.last_attempt_warning = true
206
+
207
+ # ==> Configuration for :recoverable
208
+ #
209
+ # Defines which key will be used when recovering the password for an account
210
+ # config.reset_password_keys = [:email]
211
+
212
+ # Time interval you can reset your password with a reset password key.
213
+ # Don't put a too small interval or your users won't have the time to
214
+ # change their passwords.
215
+ config.reset_password_within = 6.hours
216
+
217
+ # When set to false, does not sign a user in automatically after their password is
218
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
219
+ # config.sign_in_after_reset_password = true
220
+
221
+ # ==> Configuration for :encryptable
222
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
223
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
224
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
225
+ # for default behavior) and :restful_authentication_sha1 (then you should set
226
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
227
+ #
228
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
229
+ # config.encryptor = :sha512
230
+
231
+ # ==> Scopes configuration
232
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
233
+ # "users/sessions/new". It's turned off by default because it's slower if you
234
+ # are using only default views.
235
+ # config.scoped_views = false
236
+
237
+ # Configure the default scope given to Warden. By default it's the first
238
+ # devise role declared in your routes (usually :user).
239
+ # config.default_scope = :user
240
+
241
+ # Set this configuration to false if you want /users/sign_out to sign out
242
+ # only the current scope. By default, Devise signs out all scopes.
243
+ # config.sign_out_all_scopes = true
244
+
245
+ # ==> Navigation configuration
246
+ # Lists the formats that should be treated as navigational. Formats like
247
+ # :html, should redirect to the sign in page when the user does not have
248
+ # access, but formats like :xml or :json, should return 401.
249
+ #
250
+ # If you have any extra navigational formats, like :iphone or :mobile, you
251
+ # should add them to the navigational formats lists.
252
+ #
253
+ # The "*/*" below is required to match Internet Explorer requests.
254
+ # This is a JSON-only API app, so no navigational (browser-redirect) formats.
255
+ config.navigational_formats = []
256
+
257
+ # The default HTTP method used to sign out a resource. Default is :delete.
258
+ config.sign_out_via = :delete
259
+
260
+ # ==> OmniAuth
261
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
262
+ # up on your models and hooks.
263
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
264
+
265
+ # ==> Warden configuration
266
+ # If you want to use other strategies, that are not supported by Devise, or
267
+ # change the failure app, you can configure them inside the config.warden block.
268
+ #
269
+ # config.warden do |manager|
270
+ # manager.intercept_401 = false
271
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
272
+ # end
273
+
274
+ # ==> Mountable engine configurations
275
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
276
+ # is mountable, there are some extra configurations to be taken into account.
277
+ # The following options are available, assuming the engine is mounted as:
278
+ #
279
+ # mount MyEngine, at: '/my_engine'
280
+ #
281
+ # The router that invoked `devise_for`, in the example above, would be:
282
+ # config.router_name = :my_engine
283
+ #
284
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
285
+ # so you need to do it manually. For the users scope, it would be:
286
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
287
+
288
+ # ==> Turbolinks configuration
289
+ # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
290
+ #
291
+ # ActiveSupport.on_load(:devise_failure_app) do
292
+ # include Turbolinks::Controller
293
+ # end
294
+
295
+ # ==> Configuration for :registerable
296
+
297
+ # When set to false, does not sign a user in automatically after their password is
298
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
299
+ # config.sign_in_after_change_password = true
300
+ config.jwt do |jwt|
301
+ jwt.secret = 'secretsecret'
302
+ end
303
+ end
@@ -0,0 +1,65 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ email_changed:
27
+ subject: "Email Changed"
28
+ password_change:
29
+ subject: "Password Changed"
30
+ omniauth_callbacks:
31
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32
+ success: "Successfully authenticated from %{kind} account."
33
+ passwords:
34
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37
+ updated: "Your password has been changed successfully. You are now signed in."
38
+ updated_not_active: "Your password has been changed successfully."
39
+ registrations:
40
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41
+ signed_up: "Welcome! You have signed up successfully."
42
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46
+ updated: "Your account has been updated successfully."
47
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
48
+ sessions:
49
+ signed_in: "Signed in successfully."
50
+ signed_out: "Signed out successfully."
51
+ already_signed_out: "Signed out successfully."
52
+ unlocks:
53
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56
+ errors:
57
+ messages:
58
+ already_confirmed: "was already confirmed, please try signing in"
59
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60
+ expired: "has expired, please request a new one"
61
+ not_found: "not found"
62
+ not_locked: "was not locked"
63
+ not_saved:
64
+ one: "1 error prohibited this %{resource} from being saved:"
65
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Puma can serve each request in a thread from an internal thread pool.
4
+ # The `threads` method setting takes two numbers a minimum and maximum.
5
+ # Any libraries that use thread pools should be configured to match
6
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
7
+ # and maximum, this matches the default thread size of Active Record.
8
+ #
9
+ threads_count = ENV.fetch('RAILS_MAX_THREADS', 5).to_i
10
+ threads threads_count, threads_count
11
+
12
+ # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
13
+ #
14
+ port ENV.fetch('PORT', 3000)
15
+
16
+ # Specifies the `environment` that Puma will run in.
17
+ #
18
+ environment ENV.fetch('RAILS_ENV', 'development')
19
+
20
+ # Specifies the number of `workers` to boot in clustered mode.
21
+ # Workers are forked webserver processes. If using threads and workers together
22
+ # the concurrency of the application would be max `threads` * `workers`.
23
+ # Workers do not work on JRuby or Windows (both of which do not support
24
+ # processes).
25
+ #
26
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
27
+
28
+ # Use the `preload_app!` method when specifying a `workers` number.
29
+ # This directive tells Puma to first boot the application and load code
30
+ # before forking the application. This takes advantage of Copy On Write
31
+ # process behavior so workers use less memory. If you use this option
32
+ # you need to make sure to reconnect any threads in the `on_worker_boot`
33
+ # block.
34
+ #
35
+ # preload_app!
36
+
37
+ # The code in the `on_worker_boot` will be called if you are using
38
+ # clustered mode by specifying a number of `workers`. After each worker
39
+ # process is booted this block will be run, if you are using `preload_app!`
40
+ # option you will want to use this block to reconnect to any threads
41
+ # or connections that may have been created at application boot, Ruby
42
+ # cannot share connections between processes.
43
+ #
44
+ # on_worker_boot do
45
+ # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
46
+ # end
47
+
48
+ # Allow puma to be restarted by `rails restart` command.
49
+ plugin :tmp_restart
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ devise_for :users
5
+ resources :dummy_models
6
+
7
+ namespace :without_pagination do
8
+ resources :dummy_models, only: :index
9
+ end
10
+ 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 `rails 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: 92449804b35bbac1feb998ebbb618ff7b4564a4c096aaf257ccb1736cf1a57086b144397749bf340caddb6aed5d75e12614acfc191bbc56cc2e560001f45d836
15
+
16
+ test:
17
+ secret_key_base: 6f335f9abf6454530cd680a618acd0bb2dcd7f77920f0a382bc50844bac676af38501ca8233fae8fc5dad9daac5fd8718d7d0d1b90dbdedf69825f7c283348dd
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"] %>
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[
4
+ .ruby-version
5
+ .rbenv-vars
6
+ tmp/restart.txt
7
+ tmp/caching-dev.txt
8
+ ].each { |path| Spring.watch(path) }
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDummyModels < ActiveRecord::Migration[5.0]
4
+ def change
5
+ create_table :dummy_models do |t|
6
+ t.string :name
7
+ t.integer :something
8
+ end
9
+ end
10
+ end