Depreciation 0.1.0 → 0.1.3

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 (118) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +23 -0
  3. data/Gemfile +54 -0
  4. data/Gemfile.lock +237 -0
  5. data/README.md +24 -0
  6. data/Rakefile +6 -0
  7. data/app/assets/config/manifest.js +3 -0
  8. data/app/assets/images/.keep +0 -0
  9. data/app/assets/javascripts/application.js +17 -0
  10. data/app/assets/javascripts/brands.coffee +3 -0
  11. data/app/assets/javascripts/cable.js +13 -0
  12. data/app/assets/javascripts/channels/.keep +0 -0
  13. data/app/assets/stylesheets/application.css.scss +17 -0
  14. data/app/assets/stylesheets/brands.scss +3 -0
  15. data/app/channels/application_cable/channel.rb +4 -0
  16. data/app/channels/application_cable/connection.rb +4 -0
  17. data/app/controllers/application_controller.rb +3 -0
  18. data/app/controllers/brands_controller.rb +43 -0
  19. data/app/controllers/concerns/.keep +0 -0
  20. data/app/helpers/application_helper.rb +2 -0
  21. data/app/helpers/brands_helper.rb +2 -0
  22. data/app/jobs/application_job.rb +2 -0
  23. data/app/mailers/application_mailer.rb +4 -0
  24. data/app/models/application_record.rb +3 -0
  25. data/app/models/brand.rb +5 -0
  26. data/app/models/concerns/.keep +0 -0
  27. data/app/models/user.rb +6 -0
  28. data/app/models/variant.rb +3 -0
  29. data/app/views/brands/_form.html.erb +4 -0
  30. data/app/views/brands/edit.html.erb +3 -0
  31. data/app/views/brands/index.html.erb +5 -0
  32. data/app/views/brands/new.html.erb +2 -0
  33. data/app/views/brands/show.html.erb +36 -0
  34. data/app/views/devise/confirmations/new.html.erb +16 -0
  35. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  36. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  37. data/app/views/devise/mailer/password_change.html.erb +3 -0
  38. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  39. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  40. data/app/views/devise/passwords/edit.html.erb +19 -0
  41. data/app/views/devise/passwords/new.html.erb +15 -0
  42. data/app/views/devise/registrations/edit.html.erb +27 -0
  43. data/app/views/devise/registrations/new.html.erb +78 -0
  44. data/app/views/devise/sessions/new.html.erb +36 -0
  45. data/app/views/devise/shared/_links.html.erb +25 -0
  46. data/app/views/devise/unlocks/new.html.erb +16 -0
  47. data/app/views/layouts/application.html.erb +34 -0
  48. data/app/views/layouts/mailer.html.erb +13 -0
  49. data/app/views/layouts/mailer.text.erb +1 -0
  50. data/bin/bundle +3 -0
  51. data/bin/rails +4 -0
  52. data/bin/rake +4 -0
  53. data/bin/setup +38 -0
  54. data/bin/update +29 -0
  55. data/bin/yarn +11 -0
  56. data/config.ru +5 -0
  57. data/config/application.rb +18 -0
  58. data/config/boot.rb +3 -0
  59. data/config/cable.yml +10 -0
  60. data/config/database.yml +25 -0
  61. data/config/environment.rb +5 -0
  62. data/config/environments/development.rb +56 -0
  63. data/config/environments/production.rb +91 -0
  64. data/config/environments/test.rb +42 -0
  65. data/config/initializers/application_controller_renderer.rb +8 -0
  66. data/config/initializers/assets.rb +14 -0
  67. data/config/initializers/backtrace_silencers.rb +7 -0
  68. data/config/initializers/cookies_serializer.rb +5 -0
  69. data/config/initializers/devise.rb +283 -0
  70. data/config/initializers/filter_parameter_logging.rb +4 -0
  71. data/config/initializers/inflections.rb +16 -0
  72. data/config/initializers/mime_types.rb +4 -0
  73. data/config/initializers/simple_form.rb +170 -0
  74. data/config/initializers/simple_form_bootstrap.rb +155 -0
  75. data/config/initializers/wrap_parameters.rb +14 -0
  76. data/config/locales/devise.en.yml +64 -0
  77. data/config/locales/en.yml +33 -0
  78. data/config/locales/simple_form.en.yml +31 -0
  79. data/config/puma.rb +56 -0
  80. data/config/routes.rb +8 -0
  81. data/config/secrets.yml +32 -0
  82. data/db/migrate/20180405123506_create_brands.rb +9 -0
  83. data/db/migrate/20180405124007_create_variants.rb +18 -0
  84. data/db/migrate/20180405142003_devise_create_users.rb +44 -0
  85. data/db/schema.rb +83 -0
  86. data/db/seeds.rb +22 -0
  87. data/lib/assets/.keep +0 -0
  88. data/lib/tasks/.keep +0 -0
  89. data/lib/templates/erb/scaffold/_form.html.erb +14 -0
  90. data/log/.keep +0 -0
  91. data/package.json +7 -0
  92. data/public/404.html +67 -0
  93. data/public/422.html +67 -0
  94. data/public/500.html +66 -0
  95. data/public/apple-touch-icon-precomposed.png +0 -0
  96. data/public/apple-touch-icon.png +0 -0
  97. data/public/favicon.ico +0 -0
  98. data/public/robots.txt +1 -0
  99. data/test/application_system_test_case.rb +5 -0
  100. data/test/controllers/.keep +0 -0
  101. data/test/controllers/brands_controller_test.rb +7 -0
  102. data/test/fixtures/.keep +0 -0
  103. data/test/fixtures/brands.yml +7 -0
  104. data/test/fixtures/files/.keep +0 -0
  105. data/test/fixtures/users.yml +11 -0
  106. data/test/fixtures/variants.yml +23 -0
  107. data/test/helpers/.keep +0 -0
  108. data/test/integration/.keep +0 -0
  109. data/test/mailers/.keep +0 -0
  110. data/test/models/.keep +0 -0
  111. data/test/models/brand_test.rb +7 -0
  112. data/test/models/user_test.rb +7 -0
  113. data/test/models/variant_test.rb +7 -0
  114. data/test/system/.keep +0 -0
  115. data/test/test_helper.rb +10 -0
  116. data/tmp/.keep +0 -0
  117. data/vendor/.keep +0 -0
  118. metadata +120 -4
@@ -0,0 +1,155 @@
1
+ # frozen_string_literal: true
2
+ # Use this setup block to configure all options available in SimpleForm.
3
+ SimpleForm.setup do |config|
4
+ config.error_notification_class = 'alert alert-danger'
5
+ config.button_class = 'btn btn-default'
6
+ config.boolean_label_class = nil
7
+
8
+ config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
9
+ b.use :html5
10
+ b.use :placeholder
11
+ b.optional :maxlength
12
+ b.optional :minlength
13
+ b.optional :pattern
14
+ b.optional :min_max
15
+ b.optional :readonly
16
+ b.use :label, class: 'control-label'
17
+
18
+ b.use :input, class: 'form-control'
19
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
20
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
21
+ end
22
+
23
+ config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
24
+ b.use :html5
25
+ b.use :placeholder
26
+ b.optional :maxlength
27
+ b.optional :minlength
28
+ b.optional :readonly
29
+ b.use :label, class: 'control-label'
30
+
31
+ b.use :input
32
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
33
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
34
+ end
35
+
36
+ config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
37
+ b.use :html5
38
+ b.optional :readonly
39
+
40
+ b.wrapper tag: 'div', class: 'checkbox' do |ba|
41
+ ba.use :label_input
42
+ end
43
+
44
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
45
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
46
+ end
47
+
48
+ config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
49
+ b.use :html5
50
+ b.optional :readonly
51
+ b.use :label, class: 'control-label'
52
+ b.use :input
53
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
54
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
55
+ end
56
+
57
+ config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
58
+ b.use :html5
59
+ b.use :placeholder
60
+ b.optional :maxlength
61
+ b.optional :minlength
62
+ b.optional :pattern
63
+ b.optional :min_max
64
+ b.optional :readonly
65
+ b.use :label, class: 'col-sm-3 control-label'
66
+
67
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
68
+ ba.use :input, class: 'form-control'
69
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
70
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
71
+ end
72
+ end
73
+
74
+ config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
75
+ b.use :html5
76
+ b.use :placeholder
77
+ b.optional :maxlength
78
+ b.optional :minlength
79
+ b.optional :readonly
80
+ b.use :label, class: 'col-sm-3 control-label'
81
+
82
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
83
+ ba.use :input
84
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
85
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
86
+ end
87
+ end
88
+
89
+ config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
90
+ b.use :html5
91
+ b.optional :readonly
92
+
93
+ b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
94
+ wr.wrapper tag: 'div', class: 'checkbox' do |ba|
95
+ ba.use :label_input
96
+ end
97
+
98
+ wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
99
+ wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
100
+ end
101
+ end
102
+
103
+ config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
104
+ b.use :html5
105
+ b.optional :readonly
106
+
107
+ b.use :label, class: 'col-sm-3 control-label'
108
+
109
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
110
+ ba.use :input
111
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
112
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
113
+ end
114
+ end
115
+
116
+ config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
117
+ b.use :html5
118
+ b.use :placeholder
119
+ b.optional :maxlength
120
+ b.optional :minlength
121
+ b.optional :pattern
122
+ b.optional :min_max
123
+ b.optional :readonly
124
+ b.use :label, class: 'sr-only'
125
+
126
+ b.use :input, class: 'form-control'
127
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
128
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
129
+ end
130
+
131
+ config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
132
+ b.use :html5
133
+ b.optional :readonly
134
+ b.use :label, class: 'control-label'
135
+ b.wrapper tag: 'div', class: 'form-inline' do |ba|
136
+ ba.use :input, class: 'form-control'
137
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
138
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
139
+ end
140
+ end
141
+ # Wrappers for forms and inputs using the Bootstrap toolkit.
142
+ # Check the Bootstrap docs (http://getbootstrap.com)
143
+ # to learn about the different styles for forms and inputs,
144
+ # buttons and other elements.
145
+ config.default_wrapper = :vertical_form
146
+ config.wrapper_mappings = {
147
+ check_boxes: :vertical_radio_and_checkboxes,
148
+ radio_buttons: :vertical_radio_and_checkboxes,
149
+ file: :vertical_file_input,
150
+ boolean: :vertical_boolean,
151
+ datetime: :multi_select,
152
+ date: :multi_select,
153
+ time: :multi_select
154
+ }
155
+ end
@@ -0,0 +1,14 @@
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]
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
@@ -0,0 +1,64 @@
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 confirm link to confirm your new email address."
46
+ updated: "Your account has been updated successfully."
47
+ sessions:
48
+ signed_in: "Signed in successfully."
49
+ signed_out: "Signed out successfully."
50
+ already_signed_out: "Signed out successfully."
51
+ unlocks:
52
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
53
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
54
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
55
+ errors:
56
+ messages:
57
+ already_confirmed: "was already confirmed, please try signing in"
58
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
59
+ expired: "has expired, please request a new one"
60
+ not_found: "not found"
61
+ not_locked: "was not locked"
62
+ not_saved:
63
+ one: "1 error prohibited this %{resource} from being saved:"
64
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,33 @@
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
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at http://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,31 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+ # include_blanks:
27
+ # defaults:
28
+ # age: 'Rather not say'
29
+ # prompts:
30
+ # defaults:
31
+ # age: 'Select your age'
data/config/puma.rb ADDED
@@ -0,0 +1,56 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ threads threads_count, threads_count
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT") { 3000 }
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ environment ENV.fetch("RAILS_ENV") { "development" }
17
+
18
+ # Specifies the number of `workers` to boot in clustered mode.
19
+ # Workers are forked webserver processes. If using threads and workers together
20
+ # the concurrency of the application would be max `threads` * `workers`.
21
+ # Workers do not work on JRuby or Windows (both of which do not support
22
+ # processes).
23
+ #
24
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25
+
26
+ # Use the `preload_app!` method when specifying a `workers` number.
27
+ # This directive tells Puma to first boot the application and load code
28
+ # before forking the application. This takes advantage of Copy On Write
29
+ # process behavior so workers use less memory. If you use this option
30
+ # you need to make sure to reconnect any threads in the `on_worker_boot`
31
+ # block.
32
+ #
33
+ # preload_app!
34
+
35
+ # If you are preloading your application and using Active Record, it's
36
+ # recommended that you close any connections to the database before workers
37
+ # are forked to prevent connection leakage.
38
+ #
39
+ # before_fork do
40
+ # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41
+ # end
42
+
43
+ # The code in the `on_worker_boot` will be called if you are using
44
+ # clustered mode by specifying a number of `workers`. After each worker
45
+ # process is booted, this block will be run. If you are using the `preload_app!`
46
+ # option, you will want to use this block to reconnect to any threads
47
+ # or connections that may have been created at application boot, as Ruby
48
+ # cannot share connections between processes.
49
+ #
50
+ # on_worker_boot do
51
+ # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52
+ # end
53
+ #
54
+
55
+ # Allow puma to be restarted by `rails restart` command.
56
+ plugin :tmp_restart
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users
3
+ resources :brands do
4
+ resources :models
5
+ end
6
+ resources :advertisements
7
+ root 'advertisements#show'
8
+ end
@@ -0,0 +1,32 @@
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
+ # Shared secrets are available across all environments.
14
+
15
+ # shared:
16
+ # api_key: a1B2c3D4e5F6
17
+
18
+ # Environmental secrets are only available for that specific environment.
19
+
20
+ development:
21
+ secret_key_base: e30c84c03d941ef591207eaf519609f8b81b22420413f98ffcefb34077ba8a0394487037c8ff715c7270e5ce1ed2b9f75de62e09c3c95113f73c514d0499d21b
22
+
23
+ test:
24
+ secret_key_base: 68aeece30cb736c2d8c030a47deabd3153fe21061179c52ea19d9d3fb6b23bb32478fe21abc05f4c9050b690174e973f4fa8607ab844ff1d59fd60023cce62fa
25
+
26
+ # Do not keep production secrets in the unencrypted secrets file.
27
+ # Instead, either read values from the environment.
28
+ # Or, use `bin/rails secrets:setup` to configure encrypted secrets
29
+ # and move the `production:` environment over there.
30
+
31
+ production:
32
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,9 @@
1
+ class CreateBrands < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :brands do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ class CreateVariants < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :variants do |t|
4
+ t.string :name
5
+ t.integer :enginecap
6
+ t.integer :year
7
+ t.string :fueltype
8
+ t.string :gearshift
9
+ t.integer :fuelcap
10
+ t.integer :seating
11
+ t.float :mileage
12
+ t.float :price
13
+ t.references :brand, foreign_key: true
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DeviseCreateUsers < ActiveRecord::Migration[5.1]
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
+
36
+ t.timestamps null: false
37
+ end
38
+
39
+ add_index :users, :email, unique: true
40
+ add_index :users, :reset_password_token, unique: true
41
+ # add_index :users, :confirmation_token, unique: true
42
+ # add_index :users, :unlock_token, unique: true
43
+ end
44
+ end