introspective_admin 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +75 -0
  5. data/.ruby-version +1 -1
  6. data/.travis.yml +5 -14
  7. data/CHANGELOG.md +37 -28
  8. data/Gemfile +24 -6
  9. data/Gemfile.lock +402 -264
  10. data/README.md +34 -8
  11. data/Rakefile +3 -5
  12. data/introspective_admin.gemspec +29 -44
  13. data/lib/introspective_admin/base.rb +217 -200
  14. data/lib/introspective_admin/version.rb +5 -3
  15. data/lib/introspective_admin.rb +2 -0
  16. data/lib/tasks/introspective_admin_tasks.rake +2 -0
  17. data/spec/admin/company_admin_spec.rb +73 -72
  18. data/spec/admin/job_admin_spec.rb +63 -61
  19. data/spec/admin/location_admin_spec.rb +70 -66
  20. data/spec/admin/location_beacon_admin_spec.rb +75 -73
  21. data/spec/admin/project__admin_spec.rb +73 -71
  22. data/spec/admin/user_admin_spec.rb +65 -64
  23. data/spec/dummy/Gemfile +17 -0
  24. data/spec/dummy/README.rdoc +28 -28
  25. data/spec/dummy/Rakefile +8 -6
  26. data/spec/dummy/app/admin/admin_users.rb +29 -0
  27. data/spec/dummy/app/admin/company_admin.rb +5 -4
  28. data/spec/dummy/app/admin/dashboard.rb +34 -0
  29. data/spec/dummy/app/admin/job_admin.rb +5 -4
  30. data/spec/dummy/app/admin/location_admin.rb +5 -4
  31. data/spec/dummy/app/admin/location_beacon_admin.rb +8 -6
  32. data/spec/dummy/app/admin/project_admin.rb +5 -6
  33. data/spec/dummy/app/admin/role_admin.rb +5 -5
  34. data/spec/dummy/app/admin/user_admin.rb +13 -13
  35. data/spec/dummy/app/assets/config/manifest.js +3 -0
  36. data/spec/dummy/app/assets/javascripts/active_admin.js +1 -0
  37. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  38. data/spec/dummy/app/assets/stylesheets/active_admin.scss +17 -0
  39. data/spec/dummy/app/assets/stylesheets/application.css +15 -15
  40. data/spec/dummy/app/controllers/application_controller.rb +10 -8
  41. data/spec/dummy/app/helpers/application_helper.rb +4 -3
  42. data/spec/dummy/app/models/abstract_adapter.rb +20 -12
  43. data/spec/dummy/app/models/admin_user.rb +12 -6
  44. data/spec/dummy/app/models/company.rb +13 -12
  45. data/spec/dummy/app/models/job.rb +10 -10
  46. data/spec/dummy/app/models/locatable.rb +8 -6
  47. data/spec/dummy/app/models/location.rb +27 -26
  48. data/spec/dummy/app/models/location_beacon.rb +19 -19
  49. data/spec/dummy/app/models/location_gps.rb +11 -11
  50. data/spec/dummy/app/models/project.rb +20 -20
  51. data/spec/dummy/app/models/project_job.rb +8 -7
  52. data/spec/dummy/app/models/role.rb +26 -25
  53. data/spec/dummy/app/models/team.rb +10 -9
  54. data/spec/dummy/app/models/team_user.rb +14 -13
  55. data/spec/dummy/app/models/user.rb +72 -68
  56. data/spec/dummy/app/models/user_location.rb +28 -28
  57. data/spec/dummy/app/models/user_project_job.rb +17 -16
  58. data/spec/dummy/app/views/layouts/application.html.erb +13 -13
  59. data/spec/dummy/bin/bundle +5 -3
  60. data/spec/dummy/bin/rails +6 -4
  61. data/spec/dummy/bin/rake +6 -4
  62. data/spec/dummy/bin/setup +31 -29
  63. data/spec/dummy/config/application.rb +35 -34
  64. data/spec/dummy/config/boot.rb +7 -5
  65. data/spec/dummy/config/database.yml +22 -22
  66. data/spec/dummy/config/environment.rb +12 -11
  67. data/spec/dummy/config/environments/development.rb +47 -45
  68. data/spec/dummy/config/environments/production.rb +83 -82
  69. data/spec/dummy/config/environments/test.rb +50 -50
  70. data/spec/dummy/config/initializers/active_admin.rb +8 -7
  71. data/spec/dummy/config/initializers/assets.rb +15 -13
  72. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -7
  73. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -3
  74. data/spec/dummy/config/initializers/devise.rb +265 -263
  75. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -4
  76. data/spec/dummy/config/initializers/inflections.rb +18 -16
  77. data/spec/dummy/config/initializers/mime_types.rb +6 -4
  78. data/spec/dummy/config/initializers/session_store.rb +5 -3
  79. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -14
  80. data/spec/dummy/config/initializers/zeitwerk.rb +10 -0
  81. data/spec/dummy/config/locales/devise.en.yml +60 -60
  82. data/spec/dummy/config/locales/en.yml +23 -23
  83. data/spec/dummy/config/routes.rb +12 -9
  84. data/spec/dummy/config/secrets.yml +20 -20
  85. data/spec/dummy/config.ru +6 -4
  86. data/spec/dummy/db/development.sqlite3 +0 -0
  87. data/spec/dummy/db/migrate/20141002205024_devise_create_users.rb +43 -42
  88. data/spec/dummy/db/migrate/20141002211055_devise_create_admin_users.rb +49 -48
  89. data/spec/dummy/db/migrate/20141002211057_create_active_admin_comments.rb +21 -19
  90. data/spec/dummy/db/migrate/20141002220722_add_lockable_to_users.rb +10 -8
  91. data/spec/dummy/db/migrate/20150406213646_create_companies.rb +13 -11
  92. data/spec/dummy/db/migrate/20150414213154_add_user_authentication_token.rb +13 -11
  93. data/spec/dummy/db/migrate/20150415222005_create_roles.rb +13 -12
  94. data/spec/dummy/db/migrate/20150505181635_create_chats.rb +11 -9
  95. data/spec/dummy/db/migrate/20150505181636_create_chat_users.rb +13 -11
  96. data/spec/dummy/db/migrate/20150505181640_create_chat_messages.rb +13 -11
  97. data/spec/dummy/db/migrate/20150507191529_create_chat_message_users.rb +13 -11
  98. data/spec/dummy/db/migrate/20150601200526_create_locations.rb +15 -13
  99. data/spec/dummy/db/migrate/20150601200533_create_locatables.rb +12 -10
  100. data/spec/dummy/db/migrate/20150601212924_create_location_beacons.rb +18 -16
  101. data/spec/dummy/db/migrate/20150601213542_create_location_gps.rb +14 -12
  102. data/spec/dummy/db/migrate/20150609201823_create_user_locations.rb +16 -14
  103. data/spec/dummy/db/migrate/20150617232519_create_projects.rb +12 -10
  104. data/spec/dummy/db/migrate/20150617232521_create_jobs.rb +11 -9
  105. data/spec/dummy/db/migrate/20150617232522_create_project_jobs.rb +13 -11
  106. data/spec/dummy/db/migrate/20150623170133_create_user_project_jobs.rb +14 -12
  107. data/spec/dummy/db/migrate/20150701234929_create_teams.rb +13 -11
  108. data/spec/dummy/db/migrate/20150701234930_create_team_users.rb +13 -11
  109. data/spec/dummy/db/migrate/20150727214950_add_confirmable_to_devise.rb +13 -11
  110. data/spec/dummy/db/migrate/20150820190524_add_user_names.rb +8 -6
  111. data/spec/dummy/db/migrate/20150909225019_add_password_to_project.rb +7 -5
  112. data/spec/dummy/db/migrate/20220806003731_add_devise_to_admin_users.rb +50 -0
  113. data/spec/dummy/db/schema.rb +263 -264
  114. data/spec/dummy/public/404.html +67 -67
  115. data/spec/dummy/public/422.html +67 -67
  116. data/spec/dummy/public/500.html +66 -66
  117. data/spec/rails_helper.rb +33 -27
  118. data/spec/support/blueprints.rb +50 -49
  119. data/spec/support/location_helper.rb +28 -29
  120. metadata +21 -252
  121. data/Gemfile.lock.rails4 +0 -256
@@ -1,14 +1,16 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
- end
10
-
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
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # This file contains settings for ActionController::ParamsWrapper which
6
+ # is enabled by default.
7
+
8
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
+ ActiveSupport.on_load(:action_controller) do
10
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
11
+ end
12
+
13
+ # To enable root element in JSON for ActiveRecord objects.
14
+ # ActiveSupport.on_load(:active_record) do
15
+ # self.include_root_in_json = true
16
+ # end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails::VERSION::MAJOR > 5
4
+ Rails.autoloaders.main.ignore(
5
+ 'app/admin',
6
+ 'app/assets',
7
+ 'app/javascripts',
8
+ 'app/views'
9
+ )
10
+ end
@@ -1,60 +1,60 @@
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
- omniauth_callbacks:
27
- failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
- success: "Successfully authenticated from %{kind} account."
29
- passwords:
30
- 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."
31
- send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
- 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."
33
- updated: "Your password has been changed successfully. You are now signed in."
34
- updated_not_active: "Your password has been changed successfully."
35
- registrations:
36
- destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
- signed_up: "Welcome! You have signed up successfully."
38
- signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
- signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
- 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."
41
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
- updated: "Your account has been updated successfully."
43
- sessions:
44
- signed_in: "Signed in successfully."
45
- signed_out: "Signed out successfully."
46
- already_signed_out: "Signed out successfully."
47
- unlocks:
48
- send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
- send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
- unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
- errors:
52
- messages:
53
- already_confirmed: "was already confirmed, please try signing in"
54
- confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
- expired: "has expired, please request a new one"
56
- not_found: "not found"
57
- not_locked: "was not locked"
58
- not_saved:
59
- one: "1 error prohibited this %{resource} from being saved:"
60
- other: "%{count} errors prohibited this %{resource} from being saved:"
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
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ 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."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ 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."
33
+ updated: "Your password has been changed successfully. You are now signed in."
34
+ updated_not_active: "Your password has been changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ 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."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
+ updated: "Your account has been updated successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ already_signed_out: "Signed out successfully."
47
+ unlocks:
48
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
+ errors:
52
+ messages:
53
+ already_confirmed: "was already confirmed, please try signing in"
54
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
+ expired: "has expired, please request a new one"
56
+ not_found: "not found"
57
+ not_locked: "was not locked"
58
+ not_saved:
59
+ one: "1 error prohibited this %{resource} from being saved:"
60
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -1,23 +1,23 @@
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"
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"
@@ -1,9 +1,12 @@
1
- Rails.application.routes.draw do
2
- #devise_for :admin_users, ActiveAdmin::Devise.config
3
- devise_for :users
4
- ActiveAdmin.routes(self)
5
-
6
- # You can have the root of your site routed with "root"
7
- root 'home#index'
8
-
9
- end
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ # devise_for :admin_users, ActiveAdmin::Devise.config
5
+ # devise_for :admin_users, ActiveAdmin::Devise.config
6
+ devise_for :users
7
+
8
+ ActiveAdmin.routes(self)
9
+
10
+ # You can have the root of your site routed with "root"
11
+ root 'home#index'
12
+ end
@@ -1,20 +1,20 @@
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: 993285c8b7c44547fa1cf053bf88fa75d6f8fdf33d8e033b8915e025b252c620ef102e9c16a463c3a60b356cf5b57f27ebb35eb90f4f2674bda82c69cac4142d
15
-
16
- test:
17
- secret_key_base: ca9d4587a556cfc28464dcf7f9d73b396e53b814cd339a469bc817011485510d3a9d1d6a7fa08f65cce65bcd55727a7110de0077a952f50ce58a956b255c6903
18
-
19
- production:
20
- secret_key_base: 993285c8b7c44547fa1cf053bf88fa75d6f8fdf33d8e033b8915e025b252c620ef102e9c16a463c3a60b356cf5b57f27ebb35eb90f4f2674bda82c69cac4142d
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: 993285c8b7c44547fa1cf053bf88fa75d6f8fdf33d8e033b8915e025b252c620ef102e9c16a463c3a60b356cf5b57f27ebb35eb90f4f2674bda82c69cac4142d
15
+
16
+ test:
17
+ secret_key_base: ca9d4587a556cfc28464dcf7f9d73b396e53b814cd339a469bc817011485510d3a9d1d6a7fa08f65cce65bcd55727a7110de0077a952f50ce58a956b255c6903
18
+
19
+ production:
20
+ secret_key_base: 993285c8b7c44547fa1cf053bf88fa75d6f8fdf33d8e033b8915e025b252c620ef102e9c16a463c3a60b356cf5b57f27ebb35eb90f4f2674bda82c69cac4142d
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,6 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require File.expand_path('config/environment', __dir__)
6
+ run Rails.application
Binary file
@@ -1,42 +1,43 @@
1
- class DeviseCreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table(:users) do |t|
4
- ## Database authenticatable
5
- t.string :email, null: false, default: ""
6
- t.string :encrypted_password, null: false, default: ""
7
-
8
- ## Recoverable
9
- t.string :reset_password_token
10
- t.datetime :reset_password_sent_at
11
-
12
- ## Rememberable
13
- t.datetime :remember_created_at
14
-
15
- ## Trackable
16
- t.integer :sign_in_count, default: 0, null: false
17
- t.datetime :current_sign_in_at
18
- t.datetime :last_sign_in_at
19
- t.string :current_sign_in_ip
20
- t.string :last_sign_in_ip
21
-
22
- ## Confirmable
23
- # t.string :confirmation_token
24
- # t.datetime :confirmed_at
25
- # t.datetime :confirmation_sent_at
26
- # t.string :unconfirmed_email # Only if using reconfirmable
27
-
28
- ## Lockable
29
- # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
- # t.string :unlock_token # Only if unlock strategy is :email or :both
31
- # t.datetime :locked_at
32
-
33
-
34
- t.timestamps null: false
35
- end
36
-
37
- add_index :users, :email, unique: true
38
- add_index :users, :reset_password_token, unique: true
39
- # add_index :users, :confirmation_token, unique: true
40
- # add_index :users, :unlock_token, unique: true
41
- end
42
- end
1
+ # frozen_string_literal: true
2
+
3
+ class DeviseCreateUsers < ActiveRecord::Migration
4
+ def change
5
+ create_table(:users) do |t|
6
+ ## Database authenticatable
7
+ t.string :email, null: false, default: ''
8
+ t.string :encrypted_password, null: false, default: ''
9
+
10
+ ## Recoverable
11
+ t.string :reset_password_token
12
+ t.datetime :reset_password_sent_at
13
+
14
+ ## Rememberable
15
+ t.datetime :remember_created_at
16
+
17
+ ## Trackable
18
+ t.integer :sign_in_count, default: 0, null: false
19
+ t.datetime :current_sign_in_at
20
+ t.datetime :last_sign_in_at
21
+ t.string :current_sign_in_ip
22
+ t.string :last_sign_in_ip
23
+
24
+ ## Confirmable
25
+ # t.string :confirmation_token
26
+ # t.datetime :confirmed_at
27
+ # t.datetime :confirmation_sent_at
28
+ # t.string :unconfirmed_email # Only if using reconfirmable
29
+
30
+ ## Lockable
31
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
33
+ # t.datetime :locked_at
34
+
35
+ t.timestamps null: false
36
+ end
37
+
38
+ add_index :users, :email, unique: true
39
+ add_index :users, :reset_password_token, unique: true
40
+ # add_index :users, :confirmation_token, unique: true
41
+ # add_index :users, :unlock_token, unique: true
42
+ end
43
+ end
@@ -1,48 +1,49 @@
1
- class DeviseCreateAdminUsers < ActiveRecord::Migration
2
- def migrate(direction)
3
- super
4
- # Create a default user
5
- AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') if direction == :up
6
- end
7
-
8
- def change
9
- create_table(:admin_users) do |t|
10
- ## Database authenticatable
11
- t.string :email, null: false, default: ""
12
- t.string :encrypted_password, null: false, default: ""
13
-
14
- ## Recoverable
15
- t.string :reset_password_token
16
- t.datetime :reset_password_sent_at
17
-
18
- ## Rememberable
19
- t.datetime :remember_created_at
20
-
21
- ## Trackable
22
- t.integer :sign_in_count, default: 0, null: false
23
- t.datetime :current_sign_in_at
24
- t.datetime :last_sign_in_at
25
- t.string :current_sign_in_ip
26
- t.string :last_sign_in_ip
27
-
28
- ## Confirmable
29
- # t.string :confirmation_token
30
- # t.datetime :confirmed_at
31
- # t.datetime :confirmation_sent_at
32
- # t.string :unconfirmed_email # Only if using reconfirmable
33
-
34
- ## Lockable
35
- # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
36
- # t.string :unlock_token # Only if unlock strategy is :email or :both
37
- # t.datetime :locked_at
38
-
39
-
40
- t.timestamps null: false
41
- end
42
-
43
- add_index :admin_users, :email, unique: true
44
- add_index :admin_users, :reset_password_token, unique: true
45
- # add_index :admin_users, :confirmation_token, unique: true
46
- # add_index :admin_users, :unlock_token, unique: true
47
- end
48
- end
1
+ # frozen_string_literal: true
2
+
3
+ class DeviseCreateAdminUsers < ActiveRecord::Migration
4
+ def migrate(direction)
5
+ super
6
+ # Create a default user
7
+ AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password') if direction == :up
8
+ end
9
+
10
+ def change
11
+ create_table(:admin_users) do |t|
12
+ ## Database authenticatable
13
+ t.string :email, null: false, default: ''
14
+ t.string :encrypted_password, null: false, default: ''
15
+
16
+ ## Recoverable
17
+ t.string :reset_password_token
18
+ t.datetime :reset_password_sent_at
19
+
20
+ ## Rememberable
21
+ t.datetime :remember_created_at
22
+
23
+ ## Trackable
24
+ t.integer :sign_in_count, default: 0, null: false
25
+ t.datetime :current_sign_in_at
26
+ t.datetime :last_sign_in_at
27
+ t.string :current_sign_in_ip
28
+ t.string :last_sign_in_ip
29
+
30
+ ## Confirmable
31
+ # t.string :confirmation_token
32
+ # t.datetime :confirmed_at
33
+ # t.datetime :confirmation_sent_at
34
+ # t.string :unconfirmed_email # Only if using reconfirmable
35
+
36
+ ## Lockable
37
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
38
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
39
+ # t.datetime :locked_at
40
+
41
+ t.timestamps null: false
42
+ end
43
+
44
+ add_index :admin_users, :email, unique: true
45
+ add_index :admin_users, :reset_password_token, unique: true
46
+ # add_index :admin_users, :confirmation_token, unique: true
47
+ # add_index :admin_users, :unlock_token, unique: true
48
+ end
49
+ end
@@ -1,19 +1,21 @@
1
- class CreateActiveAdminComments < ActiveRecord::Migration
2
- def self.up
3
- create_table :active_admin_comments do |t|
4
- t.string :namespace
5
- t.text :body
6
- t.string :resource_id, null: false, foreign_key: false
7
- t.string :resource_type, null: false
8
- t.references :author, polymorphic: true
9
- t.timestamps null: false
10
- end
11
- add_index :active_admin_comments, [:namespace]
12
- add_index :active_admin_comments, [:author_type, :author_id]
13
- add_index :active_admin_comments, [:resource_type, :resource_id]
14
- end
15
-
16
- def self.down
17
- drop_table :active_admin_comments
18
- end
19
- end
1
+ # frozen_string_literal: true
2
+
3
+ class CreateActiveAdminComments < ActiveRecord::Migration
4
+ def self.up
5
+ create_table :active_admin_comments do |t|
6
+ t.string :namespace
7
+ t.text :body
8
+ t.string :resource_id, null: false, foreign_key: false
9
+ t.string :resource_type, null: false
10
+ t.references :author, polymorphic: true
11
+ t.timestamps null: false
12
+ end
13
+ add_index :active_admin_comments, [:namespace]
14
+ add_index :active_admin_comments, %i[author_type author_id]
15
+ add_index :active_admin_comments, %i[resource_type resource_id]
16
+ end
17
+
18
+ def self.down
19
+ drop_table :active_admin_comments
20
+ end
21
+ end
@@ -1,8 +1,10 @@
1
- class AddLockableToUsers < ActiveRecord::Migration
2
- def change
3
- # add Lockable columns
4
- add_column :users, :failed_attempts, :integer, default: 0, null: false
5
- add_column :users, :unlock_token, :string
6
- add_column :users, :locked_at, :datetime
7
- end
8
- end
1
+ # frozen_string_literal: true
2
+
3
+ class AddLockableToUsers < ActiveRecord::Migration
4
+ def change
5
+ # add Lockable columns
6
+ add_column :users, :failed_attempts, :integer, default: 0, null: false
7
+ add_column :users, :unlock_token, :string
8
+ add_column :users, :locked_at, :datetime
9
+ end
10
+ end
@@ -1,11 +1,13 @@
1
- class CreateCompanies < ActiveRecord::Migration
2
- def change
3
- create_table :companies do |t|
4
- t.string :name, limit: 256, null: false
5
- t.string :short_name, limit: 10, null: false
6
-
7
- t.timestamps null: false
8
- end
9
- add_index :companies, :name, unique: true
10
- end
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCompanies < ActiveRecord::Migration
4
+ def change
5
+ create_table :companies do |t|
6
+ t.string :name, limit: 256, null: false
7
+ t.string :short_name, limit: 10, null: false
8
+
9
+ t.timestamps null: false
10
+ end
11
+ add_index :companies, :name, unique: true
12
+ end
13
+ end
@@ -1,11 +1,13 @@
1
- class AddUserAuthenticationToken < ActiveRecord::Migration
2
- def change
3
- add_column :users, :authentication_token, :string
4
- add_index :users, :authentication_token, :unique => true
5
- end
6
-
7
- def down
8
- remove_index :users, :authentication_token
9
- remove_column :users, :authentication_token
10
- end
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ class AddUserAuthenticationToken < ActiveRecord::Migration
4
+ def change
5
+ add_column :users, :authentication_token, :string
6
+ add_index :users, :authentication_token, unique: true
7
+ end
8
+
9
+ def down
10
+ remove_index :users, :authentication_token
11
+ remove_column :users, :authentication_token
12
+ end
13
+ end
@@ -1,12 +1,13 @@
1
- class CreateRoles < ActiveRecord::Migration
2
- def change
3
- create_table :roles do |t|
4
- t.integer :user_id, null: false
5
- t.references :ownable, polymorphic: true, index: true
6
-
7
- t.timestamps null: false
8
- end
9
- add_index :roles, [:user_id,:ownable_type,:ownable_id], unique: true
10
- end
11
-
12
- end
1
+ # frozen_string_literal: true
2
+
3
+ class CreateRoles < ActiveRecord::Migration
4
+ def change
5
+ create_table :roles do |t|
6
+ t.integer :user_id, null: false
7
+ t.references :ownable, polymorphic: true, index: true
8
+
9
+ t.timestamps null: false
10
+ end
11
+ add_index :roles, %i[user_id ownable_type ownable_id], unique: true
12
+ end
13
+ end
@@ -1,9 +1,11 @@
1
- class CreateChats < ActiveRecord::Migration
2
- def change
3
- create_table :chats do |t|
4
- t.integer :creator_id, references: :users, foreign_key: false
5
-
6
- t.timestamps null: false
7
- end
8
- end
9
- end
1
+ # frozen_string_literal: true
2
+
3
+ class CreateChats < ActiveRecord::Migration
4
+ def change
5
+ create_table :chats do |t|
6
+ t.integer :creator_id, references: :users, foreign_key: false
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end