mini_blog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +34 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/config/mini_blog_manifest.js +2 -0
  6. data/app/assets/javascripts/mini_blog/application.js +27 -0
  7. data/app/assets/stylesheets/mini_blog/application.scss +30 -0
  8. data/app/controllers/mini_blog/application_controller.rb +5 -0
  9. data/app/controllers/mini_blog/articles_controller.rb +56 -0
  10. data/app/controllers/mini_blog/users/confirmations_controller.rb +34 -0
  11. data/app/controllers/mini_blog/users/omniauth_callbacks_controller.rb +34 -0
  12. data/app/controllers/mini_blog/users/passwords_controller.rb +39 -0
  13. data/app/controllers/mini_blog/users/registrations_controller.rb +66 -0
  14. data/app/controllers/mini_blog/users/sessions_controller.rb +32 -0
  15. data/app/controllers/mini_blog/users/unlocks_controller.rb +34 -0
  16. data/app/helpers/mini_blog/application_helper.rb +4 -0
  17. data/app/jobs/mini_blog/application_job.rb +4 -0
  18. data/app/mailers/mini_blog/application_mailer.rb +6 -0
  19. data/app/models/mini_blog/application_record.rb +5 -0
  20. data/app/models/mini_blog/article.rb +10 -0
  21. data/app/models/mini_blog/article_tag_relation.rb +9 -0
  22. data/app/models/mini_blog/image.rb +6 -0
  23. data/app/models/mini_blog/tag.rb +8 -0
  24. data/app/models/mini_blog/user.rb +10 -0
  25. data/app/uploaders/mini_blog/image_content_uploader.rb +49 -0
  26. data/app/views/kaminari/bootstrap4/_first_page.html.slim +2 -0
  27. data/app/views/kaminari/bootstrap4/_gap.html.slim +2 -0
  28. data/app/views/kaminari/bootstrap4/_last_page.html.slim +2 -0
  29. data/app/views/kaminari/bootstrap4/_next_page.html.slim +2 -0
  30. data/app/views/kaminari/bootstrap4/_page.html.slim +6 -0
  31. data/app/views/kaminari/bootstrap4/_paginator.html.slim +12 -0
  32. data/app/views/kaminari/bootstrap4/_prev_page.html.slim +2 -0
  33. data/app/views/layouts/mini_blog/application.html.slim +28 -0
  34. data/app/views/mini_blog/articles/_form.html.slim +9 -0
  35. data/app/views/mini_blog/articles/edit.html.slim +1 -0
  36. data/app/views/mini_blog/articles/index.html.slim +14 -0
  37. data/app/views/mini_blog/articles/new.html.slim +1 -0
  38. data/app/views/mini_blog/articles/show.json.ruby +3 -0
  39. data/app/views/mini_blog/users/confirmations/new.html.erb +16 -0
  40. data/app/views/mini_blog/users/mailer/confirmation_instructions.html.erb +5 -0
  41. data/app/views/mini_blog/users/mailer/email_changed.html.erb +7 -0
  42. data/app/views/mini_blog/users/mailer/password_change.html.erb +3 -0
  43. data/app/views/mini_blog/users/mailer/reset_password_instructions.html.erb +8 -0
  44. data/app/views/mini_blog/users/mailer/unlock_instructions.html.erb +7 -0
  45. data/app/views/mini_blog/users/passwords/edit.html.slim +22 -0
  46. data/app/views/mini_blog/users/passwords/new.html.slim +10 -0
  47. data/app/views/mini_blog/users/registrations/edit.html.erb +43 -0
  48. data/app/views/mini_blog/users/registrations/new.html.erb +29 -0
  49. data/app/views/mini_blog/users/sessions/new.html.slim +17 -0
  50. data/app/views/mini_blog/users/shared/_links.html.erb +25 -0
  51. data/app/views/mini_blog/users/unlocks/new.html.erb +16 -0
  52. data/config/initializers/devise.rb +279 -0
  53. data/config/locales/devise.en.yml +64 -0
  54. data/config/routes.rb +7 -0
  55. data/db/migrate/20180224022923_create_mini_blog_articles.rb +12 -0
  56. data/db/migrate/20180224025140_create_mini_blog_images.rb +9 -0
  57. data/db/migrate/20180224090210_devise_create_mini_blog_users.rb +45 -0
  58. data/db/migrate/20180224112101_create_mini_blog_tags.rb +9 -0
  59. data/db/migrate/20180224113006_create_mini_blog_article_tag_relations.rb +12 -0
  60. data/lib/mini_blog.rb +11 -0
  61. data/lib/mini_blog/engine.rb +5 -0
  62. data/lib/mini_blog/version.rb +3 -0
  63. data/lib/tasks/mini_blog_tasks.rake +4 -0
  64. metadata +260 -0
@@ -0,0 +1,17 @@
1
+ h2
2
+ | Log in
3
+ = form_with model: resource, url: user_session_path, local: true do |f|
4
+ .form-group
5
+ = f.label :email
6
+ = f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control'
7
+ .form-group
8
+ = f.label :password
9
+ br
10
+ = f.password_field :password, autocomplete: 'off', class: 'form-control'
11
+ - if devise_mapping.rememberable?
12
+ .form-group
13
+ = f.check_box :remember_me
14
+ = f.label :remember_me
15
+ button.btn.btn-outline-success
16
+ | Sign in
17
+ = render 'mini_blog/users/shared/links'
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Log in", new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
24
+ <% end -%>
25
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend unlock instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "mini_blog/users/shared/links" %>
@@ -0,0 +1,279 @@
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 = 'e7695f1e9ba0bfca7b8f23ae4290cd9163f5a667f9ea081f71ef36ca2588cd9a4a48442b8470531377f0f7b3da372613330cec0f6b81ebe73cf87593e866cd89'
12
+
13
+ # ==> Mailer Configuration
14
+ # Configure the e-mail address which will be shown in Devise::Mailer,
15
+ # note that it will be overwritten if you use your own mailer class
16
+ # with default "from" parameter.
17
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
18
+
19
+ # Configure the class responsible to send e-mails.
20
+ # config.mailer = 'Devise::Mailer'
21
+
22
+ # Configure the parent class responsible to send e-mails.
23
+ # config.parent_mailer = 'ActionMailer::Base'
24
+
25
+ # ==> ORM configuration
26
+ # Load and configure the ORM. Supports :active_record (default) and
27
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
28
+ # available as additional gems.
29
+ require 'devise/orm/active_record'
30
+
31
+ # ==> Configuration for any authentication mechanism
32
+ # Configure which keys are used when authenticating a user. The default is
33
+ # just :email. You can configure it to use [:username, :subdomain], so for
34
+ # authenticating a user, both parameters are required. Remember that those
35
+ # parameters are used only when authenticating and not when retrieving from
36
+ # session. If you need permissions, you should implement that in a before filter.
37
+ # You can also supply a hash where the value is a boolean determining whether
38
+ # or not authentication should be aborted when the value is not present.
39
+ # config.authentication_keys = [:email]
40
+
41
+ # Configure parameters from the request object used for authentication. Each entry
42
+ # given should be a request method and it will automatically be passed to the
43
+ # find_for_authentication method and considered in your model lookup. For instance,
44
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
45
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
46
+ # config.request_keys = []
47
+
48
+ # Configure which authentication keys should be case-insensitive.
49
+ # These keys will be downcased upon creating or modifying a user and when used
50
+ # to authenticate or find a user. Default is :email.
51
+ config.case_insensitive_keys = [:email]
52
+
53
+ # Configure which authentication keys should have whitespace stripped.
54
+ # These keys will have whitespace before and after removed upon creating or
55
+ # modifying a user and when used to authenticate or find a user. Default is :email.
56
+ config.strip_whitespace_keys = [:email]
57
+
58
+ # Tell if authentication through request.params is enabled. True by default.
59
+ # It can be set to an array that will enable params authentication only for the
60
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
61
+ # enable it only for database (email + password) authentication.
62
+ # config.params_authenticatable = true
63
+
64
+ # Tell if authentication through HTTP Auth is enabled. False by default.
65
+ # It can be set to an array that will enable http authentication only for the
66
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
67
+ # enable it only for database authentication. The supported strategies are:
68
+ # :database = Support basic authentication with authentication key + password
69
+ # config.http_authenticatable = false
70
+
71
+ # If 401 status code should be returned for AJAX requests. True by default.
72
+ # config.http_authenticatable_on_xhr = true
73
+
74
+ # The realm used in Http Basic Authentication. 'Application' by default.
75
+ # config.http_authentication_realm = 'Application'
76
+
77
+ # It will change confirmation, password recovery and other workflows
78
+ # to behave the same regardless if the e-mail provided was right or wrong.
79
+ # Does not affect registerable.
80
+ # config.paranoid = true
81
+
82
+ # By default Devise will store the user in session. You can skip storage for
83
+ # particular strategies by setting this option.
84
+ # Notice that if you are skipping storage for all authentication paths, you
85
+ # may want to disable generating routes to Devise's sessions controller by
86
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
87
+ config.skip_session_storage = [:http_auth]
88
+
89
+ # By default, Devise cleans up the CSRF token on authentication to
90
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
91
+ # requests for sign in and sign up, you need to get a new CSRF token
92
+ # from the server. You can disable this option at your own risk.
93
+ # config.clean_up_csrf_token_on_authentication = true
94
+
95
+ # When false, Devise will not attempt to reload routes on eager load.
96
+ # This can reduce the time taken to boot the app but if your application
97
+ # requires the Devise mappings to be loaded during boot time the application
98
+ # won't boot properly.
99
+ # config.reload_routes = true
100
+
101
+ # ==> Configuration for :database_authenticatable
102
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
103
+ # using other algorithms, it sets how many times you want the password to be hashed.
104
+ #
105
+ # Limiting the stretches to just one in testing will increase the performance of
106
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
107
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
108
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
109
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
110
+ config.stretches = Rails.env.test? ? 1 : 11
111
+
112
+ # Set up a pepper to generate the hashed password.
113
+ # config.pepper = '7916699699371e193d22dc128f6d6d4f322bb4149082485e404931b78864cb2ec621f22d045cf807d916b00a9b8bbb757b81f584f8429aef2e81a2d9b1be9a8d'
114
+
115
+ # Send a notification to the original email when the user's email is changed.
116
+ # config.send_email_changed_notification = false
117
+
118
+ # Send a notification email when the user's password is changed.
119
+ # config.send_password_change_notification = false
120
+
121
+ # ==> Configuration for :confirmable
122
+ # A period that the user is allowed to access the website even without
123
+ # confirming their account. For instance, if set to 2.days, the user will be
124
+ # able to access the website for two days without confirming their account,
125
+ # access will be blocked just in the third day. Default is 0.days, meaning
126
+ # the user cannot access the website without confirming their account.
127
+ # config.allow_unconfirmed_access_for = 2.days
128
+
129
+ # A period that the user is allowed to confirm their account before their
130
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
131
+ # their account within 3 days after the mail was sent, but on the fourth day
132
+ # their account can't be confirmed with the token any more.
133
+ # Default is nil, meaning there is no restriction on how long a user can take
134
+ # before confirming their account.
135
+ # config.confirm_within = 3.days
136
+
137
+ # If true, requires any email changes to be confirmed (exactly the same way as
138
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
139
+ # db field (see migrations). Until confirmed, new email is stored in
140
+ # unconfirmed_email column, and copied to email column on successful confirmation.
141
+ config.reconfirmable = true
142
+
143
+ # Defines which key will be used when confirming an account
144
+ # config.confirmation_keys = [:email]
145
+
146
+ # ==> Configuration for :rememberable
147
+ # The time the user will be remembered without asking for credentials again.
148
+ # config.remember_for = 2.weeks
149
+
150
+ # Invalidates all the remember me tokens when the user signs out.
151
+ config.expire_all_remember_me_on_sign_out = true
152
+
153
+ # If true, extends the user's remember period when remembered via cookie.
154
+ # config.extend_remember_period = false
155
+
156
+ # Options to be passed to the created cookie. For instance, you can set
157
+ # secure: true in order to force SSL only cookies.
158
+ # config.rememberable_options = {}
159
+
160
+ # ==> Configuration for :validatable
161
+ # Range for password length.
162
+ config.password_length = 6..128
163
+
164
+ # Email regex used to validate email formats. It simply asserts that
165
+ # one (and only one) @ exists in the given string. This is mainly
166
+ # to give user feedback and not to assert the e-mail validity.
167
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
168
+
169
+ # ==> Configuration for :timeoutable
170
+ # The time you want to timeout the user session without activity. After this
171
+ # time the user will be asked for credentials again. Default is 30 minutes.
172
+ # config.timeout_in = 30.minutes
173
+
174
+ # ==> Configuration for :lockable
175
+ # Defines which strategy will be used to lock an account.
176
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
177
+ # :none = No lock strategy. You should handle locking by yourself.
178
+ # config.lock_strategy = :failed_attempts
179
+
180
+ # Defines which key will be used when locking and unlocking an account
181
+ # config.unlock_keys = [:email]
182
+
183
+ # Defines which strategy will be used to unlock an account.
184
+ # :email = Sends an unlock link to the user email
185
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
186
+ # :both = Enables both strategies
187
+ # :none = No unlock strategy. You should handle unlocking by yourself.
188
+ # config.unlock_strategy = :both
189
+
190
+ # Number of authentication tries before locking an account if lock_strategy
191
+ # is failed attempts.
192
+ # config.maximum_attempts = 20
193
+
194
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
195
+ # config.unlock_in = 1.hour
196
+
197
+ # Warn on the last attempt before the account is locked.
198
+ # config.last_attempt_warning = true
199
+
200
+ # ==> Configuration for :recoverable
201
+ #
202
+ # Defines which key will be used when recovering the password for an account
203
+ # config.reset_password_keys = [:email]
204
+
205
+ # Time interval you can reset your password with a reset password key.
206
+ # Don't put a too small interval or your users won't have the time to
207
+ # change their passwords.
208
+ config.reset_password_within = 6.hours
209
+
210
+ # When set to false, does not sign a user in automatically after their password is
211
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
212
+ # config.sign_in_after_reset_password = true
213
+
214
+ # ==> Configuration for :encryptable
215
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
216
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
217
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
218
+ # for default behavior) and :restful_authentication_sha1 (then you should set
219
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
220
+ #
221
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
222
+ # config.encryptor = :sha512
223
+
224
+ # ==> Scopes configuration
225
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
226
+ # "users/sessions/new". It's turned off by default because it's slower if you
227
+ # are using only default views.
228
+ # config.scoped_views = false
229
+
230
+ # Configure the default scope given to Warden. By default it's the first
231
+ # devise role declared in your routes (usually :user).
232
+ # config.default_scope = :user
233
+
234
+ # Set this configuration to false if you want /users/sign_out to sign out
235
+ # only the current scope. By default, Devise signs out all scopes.
236
+ # config.sign_out_all_scopes = true
237
+
238
+ # ==> Navigation configuration
239
+ # Lists the formats that should be treated as navigational. Formats like
240
+ # :html, should redirect to the sign in page when the user does not have
241
+ # access, but formats like :xml or :json, should return 401.
242
+ #
243
+ # If you have any extra navigational formats, like :iphone or :mobile, you
244
+ # should add them to the navigational formats lists.
245
+ #
246
+ # The "*/*" below is required to match Internet Explorer requests.
247
+ # config.navigational_formats = ['*/*', :html]
248
+
249
+ # The default HTTP method used to sign out a resource. Default is :delete.
250
+ config.sign_out_via = :delete
251
+
252
+ # ==> OmniAuth
253
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
254
+ # up on your models and hooks.
255
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
256
+
257
+ # ==> Warden configuration
258
+ # If you want to use other strategies, that are not supported by Devise, or
259
+ # change the failure app, you can configure them inside the config.warden block.
260
+ #
261
+ # config.warden do |manager|
262
+ # manager.intercept_401 = false
263
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
264
+ # end
265
+
266
+ # ==> Mountable engine configurations
267
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
268
+ # is mountable, there are some extra configurations to be taken into account.
269
+ # The following options are available, assuming the engine is mounted as:
270
+ #
271
+ # mount MyEngine, at: '/my_engine'
272
+ #
273
+ # The router that invoked `devise_for`, in the example above, would be:
274
+ config.router_name = :mini_blog
275
+ #
276
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
277
+ # so you need to do it manually. For the users scope, it would be:
278
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
279
+ 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:"
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ MiniBlog::Engine.routes.draw do
2
+ root to: 'articles#index'
3
+
4
+ devise_for :users, class_name: 'MiniBlog::User', module: 'mini_blog/users'
5
+
6
+ resources :articles
7
+ end
@@ -0,0 +1,12 @@
1
+ class CreateMiniBlogArticles < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :mini_blog_articles do |t|
4
+ t.string :title, null: false
5
+ t.text :body, null: false
6
+ t.integer :status, null: false, limit: 1, default: 0
7
+ t.string :uid
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMiniBlogImages < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :mini_blog_images do |t|
4
+ t.string :content, null: false
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DeviseCreateMiniBlogUsers < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :mini_blog_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.string :name, null: false
36
+
37
+ t.timestamps null: false
38
+ end
39
+
40
+ add_index :mini_blog_users, :email, unique: true
41
+ add_index :mini_blog_users, :reset_password_token, unique: true
42
+ # add_index :mini_blog_users, :confirmation_token, unique: true
43
+ # add_index :mini_blog_users, :unlock_token, unique: true
44
+ end
45
+ end