model_base_generators 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -0
  3. data/Rakefile +13 -1
  4. data/example/.gitignore +2 -0
  5. data/example/.rspec +2 -0
  6. data/example/Gemfile +72 -0
  7. data/example/Gemfile.lock +304 -0
  8. data/example/Rakefile +6 -0
  9. data/example/app/assets/config/manifest.js +5 -0
  10. data/example/app/assets/images/.keep +0 -0
  11. data/example/app/assets/javascripts/application.js +13 -0
  12. data/example/app/assets/javascripts/cable.js +13 -0
  13. data/example/app/assets/javascripts/channels/.keep +0 -0
  14. data/example/app/assets/stylesheets/application.css +15 -0
  15. data/example/app/channels/application_cable/channel.rb +4 -0
  16. data/example/app/channels/application_cable/connection.rb +4 -0
  17. data/example/app/controllers/application_controller.rb +3 -0
  18. data/example/app/controllers/concerns/.keep +0 -0
  19. data/example/app/controllers/concerns/authentication.rb +12 -0
  20. data/{examples → example}/app/controllers/issues_controller.rb +1 -1
  21. data/example/app/controllers/projects_controller.rb +62 -0
  22. data/example/app/helpers/application_helper.rb +2 -0
  23. data/example/app/helpers/issues_helper.rb +2 -0
  24. data/example/app/helpers/projects_helper.rb +2 -0
  25. data/example/app/jobs/application_job.rb +2 -0
  26. data/example/app/mailers/application_mailer.rb +4 -0
  27. data/example/app/models/ability.rb +35 -0
  28. data/example/app/models/application_record.rb +3 -0
  29. data/example/app/models/concerns/.keep +0 -0
  30. data/example/app/models/issue.rb +16 -0
  31. data/example/app/models/project.rb +6 -0
  32. data/example/app/models/user.rb +25 -0
  33. data/example/app/validations/ar_internal_metadatum_validation.rb +8 -0
  34. data/example/app/validations/issue_validation.rb +9 -0
  35. data/example/app/validations/project_validation.rb +8 -0
  36. data/example/app/validations/user_validation.rb +10 -0
  37. data/{examples → example}/app/views/issues/_form.html.erb +8 -1
  38. data/{examples/app/views/issues/index.html.erb → example/app/views/issues/_table.html.erb} +2 -7
  39. data/{examples → example}/app/views/issues/edit.html.erb +0 -0
  40. data/example/app/views/issues/index.html.erb +9 -0
  41. data/{examples → example}/app/views/issues/new.html.erb +0 -0
  42. data/{examples → example}/app/views/issues/show.html.erb +6 -0
  43. data/example/app/views/layouts/application.html.erb +14 -0
  44. data/example/app/views/layouts/mailer.html.erb +13 -0
  45. data/example/app/views/layouts/mailer.text.erb +1 -0
  46. data/{examples → example}/app/views/projects/_form.html.erb +7 -0
  47. data/{examples/app/views/projects/index.html.erb → example/app/views/projects/_table.html.erb} +2 -9
  48. data/{examples → example}/app/views/projects/edit.html.erb +0 -0
  49. data/example/app/views/projects/index.html.erb +9 -0
  50. data/{examples → example}/app/views/projects/new.html.erb +0 -0
  51. data/{examples → example}/app/views/projects/show.html.erb +2 -0
  52. data/example/bin/bundle +3 -0
  53. data/example/bin/rails +4 -0
  54. data/example/bin/rake +4 -0
  55. data/example/bin/setup +34 -0
  56. data/example/bin/update +29 -0
  57. data/example/config/application.rb +20 -0
  58. data/example/config/boot.rb +5 -0
  59. data/example/config/cable.yml +9 -0
  60. data/example/config/database.yml +25 -0
  61. data/example/config/environment.rb +5 -0
  62. data/example/config/environments/development.rb +56 -0
  63. data/example/config/environments/production.rb +86 -0
  64. data/example/config/environments/test.rb +42 -0
  65. data/example/config/initializers/application_controller_renderer.rb +6 -0
  66. data/example/config/initializers/assets.rb +11 -0
  67. data/example/config/initializers/backtrace_silencers.rb +7 -0
  68. data/example/config/initializers/cookies_serializer.rb +5 -0
  69. data/example/config/initializers/devise.rb +274 -0
  70. data/example/config/initializers/filter_parameter_logging.rb +4 -0
  71. data/example/config/initializers/inflections.rb +16 -0
  72. data/example/config/initializers/mime_types.rb +4 -0
  73. data/example/config/initializers/new_framework_defaults.rb +24 -0
  74. data/example/config/initializers/pretty_validation.rb +5 -0
  75. data/example/config/initializers/session_store.rb +3 -0
  76. data/example/config/initializers/wrap_parameters.rb +14 -0
  77. data/example/config/locales/devise.en.yml +62 -0
  78. data/example/config/locales/en.yml +23 -0
  79. data/example/config/puma.rb +47 -0
  80. data/example/config/routes.rb +6 -0
  81. data/example/config/secrets.yml +22 -0
  82. data/example/config/spring.rb +6 -0
  83. data/example/config.ru +5 -0
  84. data/example/db/schema.rb +34 -0
  85. data/example/lib/assets/.keep +0 -0
  86. data/example/log/.keep +0 -0
  87. data/example/public/404.html +67 -0
  88. data/example/public/422.html +67 -0
  89. data/example/public/500.html +66 -0
  90. data/example/public/apple-touch-icon-precomposed.png +0 -0
  91. data/example/public/apple-touch-icon.png +0 -0
  92. data/example/public/favicon.ico +0 -0
  93. data/{examples → example}/spec/controllers/issues_controller_spec.rb +6 -6
  94. data/{examples → example}/spec/controllers/projects_controller_spec.rb +4 -4
  95. data/example/spec/factories/issues.rb +8 -0
  96. data/example/spec/factories/projects.rb +6 -0
  97. data/example/spec/factories/users.rb +8 -0
  98. data/example/spec/rails_helper.rb +57 -0
  99. data/{examples → example}/spec/routing/issues_routing_spec.rb +0 -0
  100. data/{examples → example}/spec/routing/projects_routing_spec.rb +0 -0
  101. data/example/spec/spec_helper.rb +99 -0
  102. data/example/spec/support/controller_macros.rb +18 -0
  103. data/example/spec/support/devise.rb +16 -0
  104. data/{examples → example}/spec/views/issues/edit.html.erb_spec.rb +4 -1
  105. data/example/spec/views/issues/index.html.erb_spec.rb +21 -0
  106. data/{examples → example}/spec/views/issues/new.html.erb_spec.rb +4 -1
  107. data/example/spec/views/issues/show.html.erb_spec.rb +17 -0
  108. data/{examples → example}/spec/views/projects/edit.html.erb_spec.rb +3 -1
  109. data/example/spec/views/projects/index.html.erb_spec.rb +18 -0
  110. data/{examples → example}/spec/views/projects/new.html.erb_spec.rb +3 -1
  111. data/example/spec/views/projects/show.html.erb_spec.rb +14 -0
  112. data/example/tmp/.keep +0 -0
  113. data/lib/model_base/column_attribute.rb +63 -2
  114. data/lib/model_base/config.rb +13 -2
  115. data/lib/model_base/generators/erb/scaffold.rb +23 -0
  116. data/lib/model_base/generators/factory_girl/model.rb +37 -0
  117. data/lib/model_base/meta_model.rb +77 -13
  118. data/lib/model_base/version.rb +1 -1
  119. data/lib/model_base.rb +4 -0
  120. data/lib/templates/controller.rb +1 -1
  121. data/lib/templates/erb/scaffold/_form.html.erb +1 -1
  122. data/lib/templates/erb/scaffold/_table.html.erb +39 -0
  123. data/lib/templates/erb/scaffold/index.html.erb +1 -38
  124. data/lib/templates/erb/scaffold/show.html.erb +3 -1
  125. data/lib/templates/factory_girl/factory.rb +11 -0
  126. data/lib/templates/rspec/scaffold/controller_spec.rb +8 -13
  127. data/lib/templates/rspec/scaffold/edit_spec.rb +3 -3
  128. data/lib/templates/rspec/scaffold/index_spec.rb +13 -3
  129. data/lib/templates/rspec/scaffold/new_spec.rb +3 -2
  130. data/lib/templates/rspec/scaffold/show_spec.rb +4 -4
  131. metadata +115 -25
  132. data/examples/spec/views/issues/index.html.erb_spec.rb +0 -17
  133. data/examples/spec/views/issues/show.html.erb_spec.rb +0 -14
  134. data/examples/spec/views/projects/index.html.erb_spec.rb +0 -15
  135. data/examples/spec/views/projects/show.html.erb_spec.rb +0 -12
@@ -0,0 +1,274 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # Devise will use the `secret_key_base` as its `secret_key`
8
+ # by default. You can change it below and use your own secret key.
9
+ # config.secret_key = 'fbf2543d862299685282812ca8b07c040eef4a7a66b30b98e6802f7158b129515a7be037db2cc63aad7060bd79616e06ba7be14f252d067dc8300ccd0d5d3e07'
10
+
11
+ # ==> Mailer Configuration
12
+ # Configure the e-mail address which will be shown in Devise::Mailer,
13
+ # note that it will be overwritten if you use your own mailer class
14
+ # with default "from" parameter.
15
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
16
+
17
+ # Configure the class responsible to send e-mails.
18
+ # config.mailer = 'Devise::Mailer'
19
+
20
+ # Configure the parent class responsible to send e-mails.
21
+ # config.parent_mailer = 'ActionMailer::Base'
22
+
23
+ # ==> ORM configuration
24
+ # Load and configure the ORM. Supports :active_record (default) and
25
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
26
+ # available as additional gems.
27
+ require 'devise/orm/active_record'
28
+
29
+ # ==> Configuration for any authentication mechanism
30
+ # Configure which keys are used when authenticating a user. The default is
31
+ # just :email. You can configure it to use [:username, :subdomain], so for
32
+ # authenticating a user, both parameters are required. Remember that those
33
+ # parameters are used only when authenticating and not when retrieving from
34
+ # session. If you need permissions, you should implement that in a before filter.
35
+ # You can also supply a hash where the value is a boolean determining whether
36
+ # or not authentication should be aborted when the value is not present.
37
+ # config.authentication_keys = [:email]
38
+
39
+ # Configure parameters from the request object used for authentication. Each entry
40
+ # given should be a request method and it will automatically be passed to the
41
+ # find_for_authentication method and considered in your model lookup. For instance,
42
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
43
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
44
+ # config.request_keys = []
45
+
46
+ # Configure which authentication keys should be case-insensitive.
47
+ # These keys will be downcased upon creating or modifying a user and when used
48
+ # to authenticate or find a user. Default is :email.
49
+ config.case_insensitive_keys = [:email]
50
+
51
+ # Configure which authentication keys should have whitespace stripped.
52
+ # These keys will have whitespace before and after removed upon creating or
53
+ # modifying a user and when used to authenticate or find a user. Default is :email.
54
+ config.strip_whitespace_keys = [:email]
55
+
56
+ # Tell if authentication through request.params is enabled. True by default.
57
+ # It can be set to an array that will enable params authentication only for the
58
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
59
+ # enable it only for database (email + password) authentication.
60
+ # config.params_authenticatable = true
61
+
62
+ # Tell if authentication through HTTP Auth is enabled. False by default.
63
+ # It can be set to an array that will enable http authentication only for the
64
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
65
+ # enable it only for database authentication. The supported strategies are:
66
+ # :database = Support basic authentication with authentication key + password
67
+ # config.http_authenticatable = false
68
+
69
+ # If 401 status code should be returned for AJAX requests. True by default.
70
+ # config.http_authenticatable_on_xhr = true
71
+
72
+ # The realm used in Http Basic Authentication. 'Application' by default.
73
+ # config.http_authentication_realm = 'Application'
74
+
75
+ # It will change confirmation, password recovery and other workflows
76
+ # to behave the same regardless if the e-mail provided was right or wrong.
77
+ # Does not affect registerable.
78
+ # config.paranoid = true
79
+
80
+ # By default Devise will store the user in session. You can skip storage for
81
+ # particular strategies by setting this option.
82
+ # Notice that if you are skipping storage for all authentication paths, you
83
+ # may want to disable generating routes to Devise's sessions controller by
84
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
85
+ config.skip_session_storage = [:http_auth]
86
+
87
+ # By default, Devise cleans up the CSRF token on authentication to
88
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
89
+ # requests for sign in and sign up, you need to get a new CSRF token
90
+ # from the server. You can disable this option at your own risk.
91
+ # config.clean_up_csrf_token_on_authentication = true
92
+
93
+ # When false, Devise will not attempt to reload routes on eager load.
94
+ # This can reduce the time taken to boot the app but if your application
95
+ # requires the Devise mappings to be loaded during boot time the application
96
+ # won't boot properly.
97
+ # config.reload_routes = true
98
+
99
+ # ==> Configuration for :database_authenticatable
100
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
101
+ # using other algorithms, it sets how many times you want the password to be hashed.
102
+ #
103
+ # Limiting the stretches to just one in testing will increase the performance of
104
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
105
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
106
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
107
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
108
+ config.stretches = Rails.env.test? ? 1 : 11
109
+
110
+ # Set up a pepper to generate the hashed password.
111
+ # config.pepper = 'c2c38d3712202da8536add62ab50ab76654a3dacff0f460c1a7fab9d6c98327838651c14aa2902eeb1e62dfbff791dd6db9b720d8447d3ed5b3317ce4ae47e7e'
112
+
113
+ # Send a notification email when the user's password is changed
114
+ # config.send_password_change_notification = false
115
+
116
+ # ==> Configuration for :confirmable
117
+ # A period that the user is allowed to access the website even without
118
+ # confirming their account. For instance, if set to 2.days, the user will be
119
+ # able to access the website for two days without confirming their account,
120
+ # access will be blocked just in the third day. Default is 0.days, meaning
121
+ # the user cannot access the website without confirming their account.
122
+ # config.allow_unconfirmed_access_for = 2.days
123
+
124
+ # A period that the user is allowed to confirm their account before their
125
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
126
+ # their account within 3 days after the mail was sent, but on the fourth day
127
+ # their account can't be confirmed with the token any more.
128
+ # Default is nil, meaning there is no restriction on how long a user can take
129
+ # before confirming their account.
130
+ # config.confirm_within = 3.days
131
+
132
+ # If true, requires any email changes to be confirmed (exactly the same way as
133
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
134
+ # db field (see migrations). Until confirmed, new email is stored in
135
+ # unconfirmed_email column, and copied to email column on successful confirmation.
136
+ config.reconfirmable = true
137
+
138
+ # Defines which key will be used when confirming an account
139
+ # config.confirmation_keys = [:email]
140
+
141
+ # ==> Configuration for :rememberable
142
+ # The time the user will be remembered without asking for credentials again.
143
+ # config.remember_for = 2.weeks
144
+
145
+ # Invalidates all the remember me tokens when the user signs out.
146
+ config.expire_all_remember_me_on_sign_out = true
147
+
148
+ # If true, extends the user's remember period when remembered via cookie.
149
+ # config.extend_remember_period = false
150
+
151
+ # Options to be passed to the created cookie. For instance, you can set
152
+ # secure: true in order to force SSL only cookies.
153
+ # config.rememberable_options = {}
154
+
155
+ # ==> Configuration for :validatable
156
+ # Range for password length.
157
+ config.password_length = 6..128
158
+
159
+ # Email regex used to validate email formats. It simply asserts that
160
+ # one (and only one) @ exists in the given string. This is mainly
161
+ # to give user feedback and not to assert the e-mail validity.
162
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
163
+
164
+ # ==> Configuration for :timeoutable
165
+ # The time you want to timeout the user session without activity. After this
166
+ # time the user will be asked for credentials again. Default is 30 minutes.
167
+ # config.timeout_in = 30.minutes
168
+
169
+ # ==> Configuration for :lockable
170
+ # Defines which strategy will be used to lock an account.
171
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
172
+ # :none = No lock strategy. You should handle locking by yourself.
173
+ # config.lock_strategy = :failed_attempts
174
+
175
+ # Defines which key will be used when locking and unlocking an account
176
+ # config.unlock_keys = [:email]
177
+
178
+ # Defines which strategy will be used to unlock an account.
179
+ # :email = Sends an unlock link to the user email
180
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
181
+ # :both = Enables both strategies
182
+ # :none = No unlock strategy. You should handle unlocking by yourself.
183
+ # config.unlock_strategy = :both
184
+
185
+ # Number of authentication tries before locking an account if lock_strategy
186
+ # is failed attempts.
187
+ # config.maximum_attempts = 20
188
+
189
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
190
+ # config.unlock_in = 1.hour
191
+
192
+ # Warn on the last attempt before the account is locked.
193
+ # config.last_attempt_warning = true
194
+
195
+ # ==> Configuration for :recoverable
196
+ #
197
+ # Defines which key will be used when recovering the password for an account
198
+ # config.reset_password_keys = [:email]
199
+
200
+ # Time interval you can reset your password with a reset password key.
201
+ # Don't put a too small interval or your users won't have the time to
202
+ # change their passwords.
203
+ config.reset_password_within = 6.hours
204
+
205
+ # When set to false, does not sign a user in automatically after their password is
206
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
207
+ # config.sign_in_after_reset_password = true
208
+
209
+ # ==> Configuration for :encryptable
210
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
211
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
212
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
213
+ # for default behavior) and :restful_authentication_sha1 (then you should set
214
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
215
+ #
216
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
217
+ # config.encryptor = :sha512
218
+
219
+ # ==> Scopes configuration
220
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
221
+ # "users/sessions/new". It's turned off by default because it's slower if you
222
+ # are using only default views.
223
+ # config.scoped_views = false
224
+
225
+ # Configure the default scope given to Warden. By default it's the first
226
+ # devise role declared in your routes (usually :user).
227
+ # config.default_scope = :user
228
+
229
+ # Set this configuration to false if you want /users/sign_out to sign out
230
+ # only the current scope. By default, Devise signs out all scopes.
231
+ # config.sign_out_all_scopes = true
232
+
233
+ # ==> Navigation configuration
234
+ # Lists the formats that should be treated as navigational. Formats like
235
+ # :html, should redirect to the sign in page when the user does not have
236
+ # access, but formats like :xml or :json, should return 401.
237
+ #
238
+ # If you have any extra navigational formats, like :iphone or :mobile, you
239
+ # should add them to the navigational formats lists.
240
+ #
241
+ # The "*/*" below is required to match Internet Explorer requests.
242
+ # config.navigational_formats = ['*/*', :html]
243
+
244
+ # The default HTTP method used to sign out a resource. Default is :delete.
245
+ config.sign_out_via = :delete
246
+
247
+ # ==> OmniAuth
248
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
249
+ # up on your models and hooks.
250
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
251
+
252
+ # ==> Warden configuration
253
+ # If you want to use other strategies, that are not supported by Devise, or
254
+ # change the failure app, you can configure them inside the config.warden block.
255
+ #
256
+ # config.warden do |manager|
257
+ # manager.intercept_401 = false
258
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
259
+ # end
260
+
261
+ # ==> Mountable engine configurations
262
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
263
+ # is mountable, there are some extra configurations to be taken into account.
264
+ # The following options are available, assuming the engine is mounted as:
265
+ #
266
+ # mount MyEngine, at: '/my_engine'
267
+ #
268
+ # The router that invoked `devise_for`, in the example above, would be:
269
+ # config.router_name = :my_engine
270
+ #
271
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
272
+ # so you need to do it manually. For the users scope, it would be:
273
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
274
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,24 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains migration options to ease your Rails 5.0 upgrade.
4
+ #
5
+ # Read the Rails 5.0 release notes for more info on each option.
6
+
7
+ # Enable per-form CSRF tokens. Previous versions had false.
8
+ Rails.application.config.action_controller.per_form_csrf_tokens = true
9
+
10
+ # Enable origin-checking CSRF mitigation. Previous versions had false.
11
+ Rails.application.config.action_controller.forgery_protection_origin_check = true
12
+
13
+ # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
14
+ # Previous versions had false.
15
+ ActiveSupport.to_time_preserves_timezone = true
16
+
17
+ # Require `belongs_to` associations by default. Previous versions had false.
18
+ Rails.application.config.active_record.belongs_to_required_by_default = true
19
+
20
+ # Do not halt callback chains when a callback returns false. Previous versions had true.
21
+ ActiveSupport.halt_callback_chains_on_return_false = false
22
+
23
+ # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
24
+ Rails.application.config.ssl_options = { hsts: { subdomains: true } }
@@ -0,0 +1,5 @@
1
+ PrettyValidation.configure do |config|
2
+ config.ignored_columns = {
3
+ issues: [:status],
4
+ }.map{|t,cols| cols.map{|c| "#{t}.#{c}"} }.flatten
5
+ end
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -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,62 @@
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
+ password_change:
27
+ subject: "Password Changed"
28
+ omniauth_callbacks:
29
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
30
+ success: "Successfully authenticated from %{kind} account."
31
+ passwords:
32
+ 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."
33
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
34
+ 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."
35
+ updated: "Your password has been changed successfully. You are now signed in."
36
+ updated_not_active: "Your password has been changed successfully."
37
+ registrations:
38
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
39
+ signed_up: "Welcome! You have signed up successfully."
40
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
41
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
42
+ 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."
43
+ 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."
44
+ updated: "Your account has been updated successfully."
45
+ sessions:
46
+ signed_in: "Signed in successfully."
47
+ signed_out: "Signed out successfully."
48
+ already_signed_out: "Signed out successfully."
49
+ unlocks:
50
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
51
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
52
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
53
+ errors:
54
+ messages:
55
+ already_confirmed: "was already confirmed, please try signing in"
56
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
57
+ expired: "has expired, please request a new one"
58
+ not_found: "not found"
59
+ not_locked: "was not locked"
60
+ not_saved:
61
+ one: "1 error prohibited this %{resource} from being saved:"
62
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +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"
@@ -0,0 +1,47 @@
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 }.to_i
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
+ # The code in the `on_worker_boot` will be called if you are using
36
+ # clustered mode by specifying a number of `workers`. After each worker
37
+ # process is booted this block will be run, if you are using `preload_app!`
38
+ # option you will want to use this block to reconnect to any threads
39
+ # or connections that may have been created at application boot, Ruby
40
+ # cannot share connections between processes.
41
+ #
42
+ # on_worker_boot do
43
+ # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
44
+ # end
45
+
46
+ # Allow puma to be restarted by `rails restart` command.
47
+ plugin :tmp_restart
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users
3
+ resources :projects
4
+ resources :issues
5
+ root to: 'projects#index'
6
+ 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: 31d8e125f561360e4d158f4849dd968668eb269c16043dbff212e9691dcfcf4ae1d29876923bbbb6bd17d2e4b3ab370b0fdd43c36a168d69bf5b3ccecea5a52f
15
+
16
+ test:
17
+ secret_key_base: 84bb5e92476058e1d190d8e926f72bf7586d52b649f5c24536b002a5a6ff75a7f15441e744cc7f6eca9a77da72acfe5593e4b3f281f8884f0a2c3f480e2b2cc3
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,6 @@
1
+ %w(
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ).each { |path| Spring.watch(path) }
data/example/config.ru ADDED
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ ActiveRecord::Schema.define(version: 20161013025452) do
3
+ create_table :users do |t|
4
+ t.string :email, default: "", null: false
5
+ t.string :encrypted_password, default: "", null: false
6
+ t.string :reset_password_token
7
+ t.datetime :reset_password_sent_at
8
+ t.datetime :remember_created_at
9
+ t.integer :sign_in_count, default: 0, null: false
10
+ t.datetime :current_sign_in_at
11
+ t.datetime :last_sign_in_at
12
+ t.string :current_sign_in_ip
13
+ t.string :last_sign_in_ip
14
+ t.datetime :created_at, null: false
15
+ t.datetime :updated_at, null: false
16
+ t.index :email, unique: true
17
+ end
18
+
19
+ create_table :projects do |t|
20
+ t.references :owner, null: false
21
+ t.string :name , null: false
22
+ end
23
+ add_foreign_key :projects, :users, column: 'owner_id'
24
+
25
+ create_table :issues do |t|
26
+ t.references :project, null: false, foreign_key: true
27
+ t.string :title, null: false
28
+ t.integer :status, null: false
29
+ t.references :creator, null: false
30
+ t.datetime :created_at, null: false
31
+ t.datetime :updated_at, null: false
32
+ end
33
+ add_foreign_key :issues, :users, column: 'creator_id'
34
+ end
File without changes
data/example/log/.keep ADDED
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>