administrate-field-active_storage 0.3.4 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +21 -0
  3. data/.gitignore +0 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +217 -0
  6. data/README.md +8 -1
  7. data/administrate-field-active_storage.gemspec +3 -2
  8. data/app/views/fields/active_storage/_form.html.erb +4 -1
  9. data/app/views/fields/active_storage/_index.html.erb +19 -8
  10. data/app/views/fields/active_storage/_item.html.erb +2 -1
  11. data/app/views/fields/active_storage/_items.html.erb +6 -1
  12. data/app/views/fields/active_storage/_preview.html.erb +17 -3
  13. data/app/views/fields/active_storage/_show.html.erb +1 -1
  14. data/config/i18n-tasks.yml +8 -0
  15. data/config/locales/administrate-field-active_storage.en.yml +10 -0
  16. data/config/locales/administrate-field-active_storage.ru.yml +10 -0
  17. data/contribute.md +3 -0
  18. data/lib/administrate/field/active_storage.rb +3 -3
  19. data/spec/i18n_spec.rb +35 -0
  20. data/test_app/.browserslistrc +1 -0
  21. data/test_app/.gitattributes +10 -0
  22. data/{example-project → test_app}/.gitignore +9 -7
  23. data/test_app/.ruby-version +1 -0
  24. data/test_app/Gemfile +45 -0
  25. data/test_app/Gemfile.lock +237 -0
  26. data/{example-project → test_app}/README.md +0 -0
  27. data/{example-project → test_app}/Rakefile +1 -1
  28. data/test_app/app/assets/config/manifest.js +4 -0
  29. data/{example-project → test_app}/app/assets/images/.keep +0 -0
  30. data/{example-project → test_app}/app/assets/stylesheets/application.css +0 -0
  31. data/{example-project → test_app}/app/controllers/admin/application_controller.rb +3 -3
  32. data/test_app/app/controllers/admin/posts_controller.rb +46 -0
  33. data/{example-project → test_app}/app/controllers/application_controller.rb +0 -0
  34. data/{example-project/app/dashboards/user_dashboard.rb → test_app/app/dashboards/post_dashboard.rb} +29 -27
  35. data/{example-project → test_app}/app/helpers/application_helper.rb +0 -0
  36. data/test_app/app/javascript/packs/application.js +10 -0
  37. data/{example-project → test_app}/app/models/application_record.rb +0 -0
  38. data/test_app/app/models/post.rb +3 -0
  39. data/test_app/app/views/layouts/application.html.erb +16 -0
  40. data/test_app/bin/bundle +114 -0
  41. data/test_app/bin/rails +4 -0
  42. data/test_app/bin/rake +4 -0
  43. data/{example-project → test_app}/bin/setup +6 -9
  44. data/test_app/config/application.rb +35 -0
  45. data/{example-project/bin/bundle → test_app/config/boot.rb} +2 -2
  46. data/test_app/config/credentials.yml.enc +1 -0
  47. data/{example-project → test_app}/config/database.yml +1 -1
  48. data/{example-project → test_app}/config/environment.rb +1 -1
  49. data/{example-project → test_app}/config/environments/development.rb +21 -11
  50. data/{example-project → test_app}/config/environments/production.rb +36 -24
  51. data/{example-project → test_app}/config/environments/test.rb +20 -14
  52. data/{example-project → test_app}/config/initializers/application_controller_renderer.rb +0 -0
  53. data/{example-project → test_app}/config/initializers/assets.rb +0 -0
  54. data/test_app/config/initializers/backtrace_silencers.rb +8 -0
  55. data/{example-project → test_app}/config/initializers/content_security_policy.rb +5 -0
  56. data/{example-project → test_app}/config/initializers/cookies_serializer.rb +0 -0
  57. data/{example-project → test_app}/config/initializers/filter_parameter_logging.rb +3 -1
  58. data/{example-project → test_app}/config/initializers/inflections.rb +0 -0
  59. data/{example-project → test_app}/config/initializers/mime_types.rb +0 -0
  60. data/test_app/config/initializers/permissions_policy.rb +11 -0
  61. data/{example-project → test_app}/config/initializers/wrap_parameters.rb +0 -0
  62. data/{example-project → test_app}/config/locales/en.yml +1 -1
  63. data/{example-project → test_app}/config/puma.rb +13 -4
  64. data/test_app/config/routes.rb +9 -0
  65. data/{example-project → test_app}/config/storage.yml +0 -0
  66. data/{example-project → test_app}/config.ru +2 -1
  67. data/{example-project/db/migrate/20181221134334_create_active_storage_tables.active_storage.rb → test_app/db/migrate/20210118122804_create_active_storage_tables.active_storage.rb} +15 -5
  68. data/test_app/db/migrate/20210118122927_create_posts.rb +8 -0
  69. data/{example-project → test_app}/db/schema.rb +18 -10
  70. data/{example-project → test_app}/db/seeds.rb +1 -1
  71. data/test_app/lib/active_storage/fixture_set.rb +71 -0
  72. data/{example-project → test_app}/public/404.html +0 -0
  73. data/{example-project → test_app}/public/422.html +0 -0
  74. data/{example-project → test_app}/public/500.html +0 -0
  75. data/{example-project → test_app}/public/apple-touch-icon-precomposed.png +0 -0
  76. data/{example-project → test_app}/public/apple-touch-icon.png +0 -0
  77. data/{example-project → test_app}/public/favicon.ico +0 -0
  78. data/test_app/public/robots.txt +1 -0
  79. data/{example-project → test_app}/test/application_system_test_case.rb +0 -0
  80. data/test_app/test/controllers/admin/posts_controller_test.rb +14 -0
  81. data/test_app/test/fixtures/active_storage/attachments.yml +4 -0
  82. data/test_app/test/fixtures/active_storage/blobs.yml +2 -0
  83. data/test_app/test/fixtures/files/cover_image.jpg +0 -0
  84. data/test_app/test/fixtures/posts.yml +11 -0
  85. data/test_app/test/models/post_test.rb +9 -0
  86. data/test_app/test/test_helper.rb +20 -0
  87. metadata +97 -99
  88. data/Rakefile +0 -22
  89. data/example-project/.ruby-version +0 -1
  90. data/example-project/Gemfile +0 -67
  91. data/example-project/Gemfile.lock +0 -265
  92. data/example-project/app/assets/config/manifest.js +0 -3
  93. data/example-project/app/assets/javascripts/application.js +0 -16
  94. data/example-project/app/assets/javascripts/cable.js +0 -13
  95. data/example-project/app/assets/javascripts/channels/.keep +0 -0
  96. data/example-project/app/channels/application_cable/channel.rb +0 -4
  97. data/example-project/app/channels/application_cable/connection.rb +0 -4
  98. data/example-project/app/controllers/admin/users_controller.rb +0 -27
  99. data/example-project/app/controllers/concerns/.keep +0 -0
  100. data/example-project/app/controllers/users_controller.rb +0 -7
  101. data/example-project/app/jobs/application_job.rb +0 -2
  102. data/example-project/app/mailers/application_mailer.rb +0 -4
  103. data/example-project/app/models/concerns/.keep +0 -0
  104. data/example-project/app/models/user.rb +0 -3
  105. data/example-project/app/views/layouts/application.html.erb +0 -15
  106. data/example-project/app/views/layouts/mailer.html.erb +0 -13
  107. data/example-project/app/views/layouts/mailer.text.erb +0 -1
  108. data/example-project/bin/rails +0 -9
  109. data/example-project/bin/rake +0 -9
  110. data/example-project/bin/spring +0 -17
  111. data/example-project/bin/update +0 -31
  112. data/example-project/bin/yarn +0 -11
  113. data/example-project/config/application.rb +0 -19
  114. data/example-project/config/boot.rb +0 -4
  115. data/example-project/config/cable.yml +0 -10
  116. data/example-project/config/credentials.yml.enc +0 -1
  117. data/example-project/config/initializers/backtrace_silencers.rb +0 -7
  118. data/example-project/config/routes.rb +0 -10
  119. data/example-project/config/spring.rb +0 -6
  120. data/example-project/db/migrate/20181013145025_create_users.rb +0 -9
  121. data/example-project/lib/assets/.keep +0 -0
  122. data/example-project/lib/tasks/.keep +0 -0
  123. data/example-project/log/.keep +0 -0
  124. data/example-project/package.json +0 -5
  125. data/example-project/public/robots.txt +0 -1
  126. data/example-project/test/controllers/.keep +0 -0
  127. data/example-project/test/fixtures/.keep +0 -0
  128. data/example-project/test/fixtures/files/.keep +0 -0
  129. data/example-project/test/fixtures/users.yml +0 -7
  130. data/example-project/test/helpers/.keep +0 -0
  131. data/example-project/test/integration/.keep +0 -0
  132. data/example-project/test/mailers/.keep +0 -0
  133. data/example-project/test/models/.keep +0 -0
  134. data/example-project/test/models/user_test.rb +0 -7
  135. data/example-project/test/system/.keep +0 -0
  136. data/example-project/test/test_helper.rb +0 -10
  137. data/example-project/tmp/.keep +0 -0
  138. data/example-project/vendor/.keep +0 -0
@@ -0,0 +1,237 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ administrate-field-active_storage (0.3.6)
5
+ administrate (>= 0.2.2)
6
+ rails (>= 6.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (6.1.1)
12
+ actionpack (= 6.1.1)
13
+ activesupport (= 6.1.1)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (6.1.1)
17
+ actionpack (= 6.1.1)
18
+ activejob (= 6.1.1)
19
+ activerecord (= 6.1.1)
20
+ activestorage (= 6.1.1)
21
+ activesupport (= 6.1.1)
22
+ mail (>= 2.7.1)
23
+ actionmailer (6.1.1)
24
+ actionpack (= 6.1.1)
25
+ actionview (= 6.1.1)
26
+ activejob (= 6.1.1)
27
+ activesupport (= 6.1.1)
28
+ mail (~> 2.5, >= 2.5.4)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.1.1)
31
+ actionview (= 6.1.1)
32
+ activesupport (= 6.1.1)
33
+ rack (~> 2.0, >= 2.0.9)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.1.1)
38
+ actionpack (= 6.1.1)
39
+ activerecord (= 6.1.1)
40
+ activestorage (= 6.1.1)
41
+ activesupport (= 6.1.1)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.1.1)
44
+ activesupport (= 6.1.1)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (6.1.1)
50
+ activesupport (= 6.1.1)
51
+ globalid (>= 0.3.6)
52
+ activemodel (6.1.1)
53
+ activesupport (= 6.1.1)
54
+ activerecord (6.1.1)
55
+ activemodel (= 6.1.1)
56
+ activesupport (= 6.1.1)
57
+ activestorage (6.1.1)
58
+ actionpack (= 6.1.1)
59
+ activejob (= 6.1.1)
60
+ activerecord (= 6.1.1)
61
+ activesupport (= 6.1.1)
62
+ marcel (~> 0.3.1)
63
+ mimemagic (~> 0.3.2)
64
+ activesupport (6.1.1)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
70
+ addressable (2.7.0)
71
+ public_suffix (>= 2.0.2, < 5.0)
72
+ administrate (0.14.0)
73
+ actionpack (>= 4.2)
74
+ actionview (>= 4.2)
75
+ activerecord (>= 4.2)
76
+ autoprefixer-rails (>= 6.0)
77
+ datetime_picker_rails (~> 0.0.7)
78
+ jquery-rails (>= 4.0)
79
+ kaminari (>= 1.0)
80
+ momentjs-rails (~> 2.8)
81
+ sassc-rails (~> 2.1)
82
+ selectize-rails (~> 0.6)
83
+ autoprefixer-rails (10.2.0.0)
84
+ execjs
85
+ bindex (0.8.1)
86
+ builder (3.2.4)
87
+ byebug (11.1.3)
88
+ capybara (3.34.0)
89
+ addressable
90
+ mini_mime (>= 0.1.3)
91
+ nokogiri (~> 1.8)
92
+ rack (>= 1.6.0)
93
+ rack-test (>= 0.6.3)
94
+ regexp_parser (~> 1.5)
95
+ xpath (~> 3.2)
96
+ childprocess (3.0.0)
97
+ concurrent-ruby (1.1.8)
98
+ crass (1.0.6)
99
+ datetime_picker_rails (0.0.7)
100
+ momentjs-rails (>= 2.8.1)
101
+ erubi (1.10.0)
102
+ execjs (2.7.0)
103
+ ffi (1.14.2)
104
+ globalid (0.4.2)
105
+ activesupport (>= 4.2.0)
106
+ i18n (1.8.7)
107
+ concurrent-ruby (~> 1.0)
108
+ jquery-rails (4.4.0)
109
+ rails-dom-testing (>= 1, < 3)
110
+ railties (>= 4.2.0)
111
+ thor (>= 0.14, < 2.0)
112
+ kaminari (1.2.1)
113
+ activesupport (>= 4.1.0)
114
+ kaminari-actionview (= 1.2.1)
115
+ kaminari-activerecord (= 1.2.1)
116
+ kaminari-core (= 1.2.1)
117
+ kaminari-actionview (1.2.1)
118
+ actionview
119
+ kaminari-core (= 1.2.1)
120
+ kaminari-activerecord (1.2.1)
121
+ activerecord
122
+ kaminari-core (= 1.2.1)
123
+ kaminari-core (1.2.1)
124
+ loofah (2.9.0)
125
+ crass (~> 1.0.2)
126
+ nokogiri (>= 1.5.9)
127
+ mail (2.7.1)
128
+ mini_mime (>= 0.1.1)
129
+ marcel (0.3.3)
130
+ mimemagic (~> 0.3.2)
131
+ method_source (1.0.0)
132
+ mimemagic (0.3.5)
133
+ mini_mime (1.0.2)
134
+ minitest (5.14.3)
135
+ momentjs-rails (2.20.1)
136
+ railties (>= 3.1)
137
+ nio4r (2.5.4)
138
+ nokogiri (1.11.1-x86_64-darwin)
139
+ racc (~> 1.4)
140
+ public_suffix (4.0.6)
141
+ puma (5.1.1)
142
+ nio4r (~> 2.0)
143
+ racc (1.5.2)
144
+ rack (2.2.3)
145
+ rack-mini-profiler (2.3.0)
146
+ rack (>= 1.2.0)
147
+ rack-test (1.1.0)
148
+ rack (>= 1.0, < 3)
149
+ rails (6.1.1)
150
+ actioncable (= 6.1.1)
151
+ actionmailbox (= 6.1.1)
152
+ actionmailer (= 6.1.1)
153
+ actionpack (= 6.1.1)
154
+ actiontext (= 6.1.1)
155
+ actionview (= 6.1.1)
156
+ activejob (= 6.1.1)
157
+ activemodel (= 6.1.1)
158
+ activerecord (= 6.1.1)
159
+ activestorage (= 6.1.1)
160
+ activesupport (= 6.1.1)
161
+ bundler (>= 1.15.0)
162
+ railties (= 6.1.1)
163
+ sprockets-rails (>= 2.0.0)
164
+ rails-dom-testing (2.0.3)
165
+ activesupport (>= 4.2.0)
166
+ nokogiri (>= 1.6)
167
+ rails-html-sanitizer (1.3.0)
168
+ loofah (~> 2.3)
169
+ railties (6.1.1)
170
+ actionpack (= 6.1.1)
171
+ activesupport (= 6.1.1)
172
+ method_source
173
+ rake (>= 0.8.7)
174
+ thor (~> 1.0)
175
+ rake (13.0.3)
176
+ regexp_parser (1.8.2)
177
+ rubyzip (2.3.0)
178
+ sass-rails (6.0.0)
179
+ sassc-rails (~> 2.1, >= 2.1.1)
180
+ sassc (2.4.0)
181
+ ffi (~> 1.9)
182
+ sassc-rails (2.1.2)
183
+ railties (>= 4.0.0)
184
+ sassc (>= 2.0)
185
+ sprockets (> 3.0)
186
+ sprockets-rails
187
+ tilt
188
+ selectize-rails (0.12.6)
189
+ selenium-webdriver (3.142.7)
190
+ childprocess (>= 0.5, < 4.0)
191
+ rubyzip (>= 1.2.2)
192
+ sprockets (4.0.2)
193
+ concurrent-ruby (~> 1.0)
194
+ rack (> 1, < 3)
195
+ sprockets-rails (3.2.2)
196
+ actionpack (>= 4.0)
197
+ activesupport (>= 4.0)
198
+ sprockets (>= 3.0.0)
199
+ sqlite3 (1.4.2)
200
+ thor (1.1.0)
201
+ tilt (2.0.10)
202
+ tzinfo (2.0.4)
203
+ concurrent-ruby (~> 1.0)
204
+ web-console (4.1.0)
205
+ actionview (>= 6.0.0)
206
+ activemodel (>= 6.0.0)
207
+ bindex (>= 0.4.0)
208
+ railties (>= 6.0.0)
209
+ websocket-driver (0.7.3)
210
+ websocket-extensions (>= 0.1.0)
211
+ websocket-extensions (0.1.5)
212
+ xpath (3.2.0)
213
+ nokogiri (~> 1.8)
214
+ zeitwerk (2.4.2)
215
+
216
+ PLATFORMS
217
+ x86_64-darwin-20
218
+
219
+ DEPENDENCIES
220
+ administrate (~> 0.14.0)
221
+ administrate-field-active_storage!
222
+ byebug
223
+ capybara (>= 3.26)
224
+ puma (~> 5.0)
225
+ rack-mini-profiler (~> 2.0)
226
+ rails (~> 6.1.1)
227
+ sass-rails (>= 6)
228
+ selenium-webdriver
229
+ sqlite3 (~> 1.4)
230
+ tzinfo-data
231
+ web-console (>= 4.1.0)
232
+
233
+ RUBY VERSION
234
+ ruby 3.0.0p0
235
+
236
+ BUNDLED WITH
237
+ 2.2.5
File without changes
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require_relative 'config/application'
4
+ require_relative "config/application"
5
5
 
6
6
  Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link administrate/application.css
4
+ //= link administrate/application.js
@@ -1,6 +1,6 @@
1
- # All Administrate controllers inherit from this `Admin::ApplicationController`,
2
- # making it the ideal place to put authentication logic or other
3
- # before_actions.
1
+ # All Administrate controllers inherit from this
2
+ # `Administrate::ApplicationController`, making it the ideal place to put
3
+ # authentication logic or other before_actions.
4
4
  #
5
5
  # If you want to add pagination or other controller-level concerns,
6
6
  # you're free to overwrite the RESTful controller actions.
@@ -0,0 +1,46 @@
1
+ module Admin
2
+ class PostsController < Admin::ApplicationController
3
+ # Overwrite any of the RESTful controller actions to implement custom behavior
4
+ # For example, you may want to send an email after a foo is updated.
5
+ #
6
+ # def update
7
+ # super
8
+ # send_foo_updated_email(requested_resource)
9
+ # end
10
+
11
+ # Override this method to specify custom lookup behavior.
12
+ # This will be used to set the resource for the `show`, `edit`, and `update`
13
+ # actions.
14
+ #
15
+ # def find_resource(param)
16
+ # Foo.find_by!(slug: param)
17
+ # end
18
+
19
+ # The result of this lookup will be available as `requested_resource`
20
+
21
+ # Override this if you have certain roles that require a subset
22
+ # this will be used to set the records shown on the `index` action.
23
+ #
24
+ # def scoped_resource
25
+ # if current_user.super_admin?
26
+ # resource_class
27
+ # else
28
+ # resource_class.with_less_stuff
29
+ # end
30
+ # end
31
+
32
+ # Override `resource_params` if you want to transform the submitted
33
+ # data before it's persisted. For example, the following would turn all
34
+ # empty values into nil values. It uses other APIs such as `resource_class`
35
+ # and `dashboard`:
36
+ #
37
+ # def resource_params
38
+ # params.require(resource_class.model_name.param_key).
39
+ # permit(dashboard.permitted_attributes).
40
+ # transform_values { |value| value == "" ? nil : value }
41
+ # end
42
+
43
+ # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
44
+ # for more information
45
+ end
46
+ end
@@ -1,6 +1,6 @@
1
1
  require "administrate/base_dashboard"
2
2
 
3
- class UserDashboard < Administrate::BaseDashboard
3
+ class PostDashboard < Administrate::BaseDashboard
4
4
  # ATTRIBUTE_TYPES
5
5
  # a hash that describes the type of each of the model's fields.
6
6
  #
@@ -9,12 +9,9 @@ class UserDashboard < Administrate::BaseDashboard
9
9
  # on pages throughout the dashboard.
10
10
  ATTRIBUTE_TYPES = {
11
11
  id: Field::Number,
12
- name: Field::String,
13
- avatars: Field::ActiveStorage.with_options(
14
- show_in_index: true
15
- ),
12
+ cover_image: Field::ActiveStorage,
16
13
  created_at: Field::DateTime,
17
- updated_at: Field::DateTime
14
+ updated_at: Field::DateTime,
18
15
  }.freeze
19
16
 
20
17
  # COLLECTION_ATTRIBUTES
@@ -22,39 +19,44 @@ class UserDashboard < Administrate::BaseDashboard
22
19
  #
23
20
  # By default, it's limited to four items to reduce clutter on index pages.
24
21
  # Feel free to add, remove, or rearrange items.
25
- COLLECTION_ATTRIBUTES = [
26
- :id,
27
- :name,
28
- :avatars
22
+ COLLECTION_ATTRIBUTES = %i[
23
+ id
24
+ cover_image
25
+ created_at
29
26
  ].freeze
30
27
 
31
28
  # SHOW_PAGE_ATTRIBUTES
32
29
  # an array of attributes that will be displayed on the model's show page.
33
- SHOW_PAGE_ATTRIBUTES = [
34
- :id,
35
- :name,
36
- :avatars,
37
- :created_at,
38
- :updated_at
30
+ SHOW_PAGE_ATTRIBUTES = %i[
31
+ id
32
+ cover_image
33
+ created_at
34
+ updated_at
39
35
  ].freeze
40
36
 
41
37
  # FORM_ATTRIBUTES
42
38
  # an array of attributes that will be displayed
43
39
  # on the model's form (`new` and `edit`) pages.
44
- FORM_ATTRIBUTES = [
45
- :name,
46
- :avatars
40
+ FORM_ATTRIBUTES = %i[
41
+ cover_image
47
42
  ].freeze
48
43
 
49
- # Overwrite this method to customize how users are displayed
44
+ # COLLECTION_FILTERS
45
+ # a hash that defines filters that can be used while searching via the search
46
+ # field of the dashboard.
47
+ #
48
+ # For example to add an option to search for open resources by typing "open:"
49
+ # in the search field:
50
+ #
51
+ # COLLECTION_FILTERS = {
52
+ # open: ->(resources) { resources.where(open: true) }
53
+ # }.freeze
54
+ COLLECTION_FILTERS = {}.freeze
55
+
56
+ # Overwrite this method to customize how posts are displayed
50
57
  # across all pages of the admin dashboard.
51
58
  #
52
- # def display_resource(user)
53
- # "User ##{user.id}"
59
+ # def display_resource(post)
60
+ # "Post ##{post.id}"
54
61
  # end
55
-
56
- # permitted for has_many_attached
57
- def permitted_attributes
58
- super + [:avatars => []]
59
- end
60
62
  end
@@ -0,0 +1,10 @@
1
+ // This file is automatically compiled by Webpack, along with any other files
2
+ // present in this directory. You're encouraged to place your actual application logic in
3
+ // a relevant structure within app/javascript and only use these pack files to reference
4
+ // that code so it'll be compiled.
5
+
6
+ import Rails from "@rails/ujs"
7
+ import * as ActiveStorage from "@rails/activestorage"
8
+
9
+ Rails.start()
10
+ ActiveStorage.start()
@@ -0,0 +1,3 @@
1
+ class Post < ApplicationRecord
2
+ has_one_attached :cover_image
3
+ end
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestApp</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag 'application', media: 'all' %>
10
+ <%= javascript_pack_tag 'application' %>
11
+ </head>
12
+
13
+ <body>
14
+ <%= yield %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||=
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/test_app/bin/rake ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'fileutils'
3
- include FileUtils
2
+ require "fileutils"
4
3
 
5
4
  # path to your application root.
6
5
  APP_ROOT = File.expand_path('..', __dir__)
@@ -9,24 +8,22 @@ def system!(*args)
9
8
  system(*args) || abort("\n== Command #{args} failed ==")
10
9
  end
11
10
 
12
- chdir APP_ROOT do
13
- # This script is a starting point to setup your application.
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
14
  # Add necessary setup steps to this file.
15
15
 
16
16
  puts '== Installing dependencies =='
17
17
  system! 'gem install bundler --conservative'
18
18
  system('bundle check') || system!('bundle install')
19
19
 
20
- # Install JavaScript dependencies if using Yarn
21
- # system('bin/yarn')
22
-
23
20
  # puts "\n== Copying sample files =="
24
21
  # unless File.exist?('config/database.yml')
25
- # cp 'config/database.yml.sample', 'config/database.yml'
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26
23
  # end
27
24
 
28
25
  puts "\n== Preparing database =="
29
- system! 'bin/rails db:setup'
26
+ system! 'bin/rails db:prepare'
30
27
 
31
28
  puts "\n== Removing old logs and tempfiles =="
32
29
  system! 'bin/rails log:clear tmp:clear'
@@ -0,0 +1,35 @@
1
+ require_relative "boot"
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ # require "active_job/railtie"
7
+ require "active_record/railtie"
8
+ require "active_storage/engine"
9
+ require "action_controller/railtie"
10
+ # require "action_mailer/railtie"
11
+ # require "action_mailbox/engine"
12
+ require "action_text/engine"
13
+ require "action_view/railtie"
14
+ # require "action_cable/engine"
15
+ require "sprockets/railtie"
16
+ require "rails/test_unit/railtie"
17
+
18
+ # Require the gems listed in Gemfile, including any gems
19
+ # you've limited to :test, :development, or :production.
20
+ Bundler.require(*Rails.groups)
21
+
22
+ module TestApp
23
+ class Application < Rails::Application
24
+ # Initialize configuration defaults for originally generated Rails version.
25
+ config.load_defaults 6.1
26
+
27
+ # Configuration for the application, engines, and railties goes here.
28
+ #
29
+ # These settings can be overridden in specific environments using the files
30
+ # in config/environments, which are processed later.
31
+ #
32
+ # config.time_zone = "Central Time (US & Canada)"
33
+ # config.eager_load_paths << Rails.root.join("extras")
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
- load Gem.bin_path('bundler', 'bundle')
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
@@ -0,0 +1 @@
1
+ i1RHqAFd5oiOM29DrWbD9WYF5l5C/XG14osIyczMuuOjI45/mP2isQ9DPwmC9UR/mrd7eLyxEM70iCplx4aKT4/iftbcsPS3ak9D5eE0RR/cbcm0IVAS2E51U/uLPfH0tXBrYPYdiMJZdGaIxGGsb1Cmld/ALyBSJpZEpB9s/sN5z7ztBgIIhmy99n11v0G8kSHGTW8wyT4t6MBc8XHWTn7xewXN5VEey3EKIrG97M7YNhejWvDh9t/ie8tqN57z/t39DPZBgp8qx6j2fvTXiDnK1uPYy1yfYh8gGep3zVY3aGoRcoE2FTxiN3z/LrXJ0lg1YP3u0XEe1024L/PMDOGKmzVBMacpaSmp+OqYiDA4ESBsmIzq7KzyRTmGEqNjW2HYIjWsN/VQwtMqmxLNm8ocays3NuJJ1OBM--mpaHcN0jB0IR35Gv--UwJpEd/6UHCqBvoJn/RYvg==
@@ -1,4 +1,4 @@
1
- # SQLite version 3.x
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
2
  # gem install sqlite3
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require_relative 'application'
2
+ require_relative "application"
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!