trusty-cms 7.0.49 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/builds/trusty_cms/ckeditor5.css +459 -81
- data/app/assets/builds/trusty_cms/ckeditor5.css.map +3 -3
- data/app/assets/builds/trusty_cms/ckeditor5.js +11247 -7722
- data/app/assets/builds/trusty_cms/ckeditor5.js.map +4 -4
- data/app/assets/stylesheets/admin/assets.scss +5 -0
- data/app/controllers/admin/assets_controller.rb +7 -14
- data/app/javascript/plugins/asset_tags/asset_tag_builder.js +7 -2
- data/app/models/asset.rb +144 -48
- data/app/models/asset_type.rb +29 -25
- data/app/views/admin/assets/_search_results.html.haml +2 -3
- data/app/views/admin/assets/edit.html.haml +2 -2
- data/app/views/admin/assets/remove.html.haml +1 -1
- data/app/views/admin/configuration/_clipped_edit.html.haml +1 -0
- data/app/views/admin/configuration/_clipped_show.html.haml +2 -0
- data/config/database.yml +30 -0
- data/config/initializers/trusty_cms_config.rb +3 -50
- data/config/locales/en.yml +6 -1
- data/config/routes.rb +0 -2
- data/db/migrate/20110606111250_update_configuration.rb +0 -16
- data/lib/trusty_cms/geometry.rb +117 -0
- data/lib/trusty_cms/version.rb +1 -1
- data/spec/dummy/log/development.log +345 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
- data/spec/dummy/tmp/local_secret.txt +1 -0
- data/spec/dummy/tmp/trusty_config_cache.txt +0 -0
- data/spec/lib/trusty_cms/geometry_spec.rb +28 -0
- data/spec/models/asset_spec.rb +235 -12
- data/trusty_cms.gemspec +1 -1
- data/vendor/extensions/clipped-extension/clipped_extension.rb +4 -9
- data/vendor/extensions/clipped-extension/lib/asset_tags.rb +10 -4
- data/vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb +11 -35
- data/vendor/extensions/clipped-extension/lib/tasks/active_storage_tasks.rake +66 -0
- data/vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake +5 -2
- data/vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb +32 -27
- data/yarn.lock +9 -9
- metadata +21 -8
- data/lib/trusty_cms/deprecation.rb +0 -15
- data/vendor/extensions/clipped-extension/lib/paperclip/frame_grab.rb +0 -73
- data/vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb +0 -80
- data/vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake +0 -79
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trusty-cms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TrustyCms CMS dev team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activestorage-validator
|
|
@@ -941,6 +941,7 @@ files:
|
|
|
941
941
|
- config/application.rb
|
|
942
942
|
- config/boot.rb
|
|
943
943
|
- config/database.mysql.yml
|
|
944
|
+
- config/database.yml
|
|
944
945
|
- config/environment.rb
|
|
945
946
|
- config/environments/development.rb
|
|
946
947
|
- config/environments/production.rb
|
|
@@ -1134,12 +1135,12 @@ files:
|
|
|
1134
1135
|
- lib/trusty_cms/admin_ui/region_set.rb
|
|
1135
1136
|
- lib/trusty_cms/available_locales.rb
|
|
1136
1137
|
- lib/trusty_cms/config/definition.rb
|
|
1137
|
-
- lib/trusty_cms/deprecation.rb
|
|
1138
1138
|
- lib/trusty_cms/engine.rb
|
|
1139
1139
|
- lib/trusty_cms/extension.rb
|
|
1140
1140
|
- lib/trusty_cms/extension_loader.rb
|
|
1141
1141
|
- lib/trusty_cms/extension_migrator.rb
|
|
1142
1142
|
- lib/trusty_cms/extension_path.rb
|
|
1143
|
+
- lib/trusty_cms/geometry.rb
|
|
1143
1144
|
- lib/trusty_cms/initializer.rb
|
|
1144
1145
|
- lib/trusty_cms/pagination/controller.rb
|
|
1145
1146
|
- lib/trusty_cms/pagination/link_renderer.rb
|
|
@@ -1194,11 +1195,17 @@ files:
|
|
|
1194
1195
|
- spec/dummy/config/secrets.yml
|
|
1195
1196
|
- spec/dummy/config/storage.yml
|
|
1196
1197
|
- spec/dummy/db/schema.rb
|
|
1198
|
+
- spec/dummy/log/development.log
|
|
1199
|
+
- spec/dummy/log/test.log
|
|
1197
1200
|
- spec/dummy/package.json
|
|
1198
1201
|
- spec/dummy/public/404.html
|
|
1199
1202
|
- spec/dummy/public/422.html
|
|
1200
1203
|
- spec/dummy/public/500.html
|
|
1201
1204
|
- spec/dummy/public/favicon.ico
|
|
1205
|
+
- spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig
|
|
1206
|
+
- spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime
|
|
1207
|
+
- spec/dummy/tmp/local_secret.txt
|
|
1208
|
+
- spec/dummy/tmp/trusty_config_cache.txt
|
|
1202
1209
|
- spec/dummy/yarn.lock
|
|
1203
1210
|
- spec/factories/layout.rb
|
|
1204
1211
|
- spec/factories/page.rb
|
|
@@ -1211,6 +1218,7 @@ files:
|
|
|
1211
1218
|
- spec/fixtures/files/sample.ics
|
|
1212
1219
|
- spec/fixtures/files/sample.txt
|
|
1213
1220
|
- spec/fixtures/users.yml
|
|
1221
|
+
- spec/lib/trusty_cms/geometry_spec.rb
|
|
1214
1222
|
- spec/models/asset_spec.rb
|
|
1215
1223
|
- spec/models/layout_spec.rb
|
|
1216
1224
|
- spec/models/snippets_spec.rb
|
|
@@ -1226,10 +1234,8 @@ files:
|
|
|
1226
1234
|
- vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb
|
|
1227
1235
|
- vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb
|
|
1228
1236
|
- vendor/extensions/clipped-extension/lib/page_asset_associations.rb
|
|
1229
|
-
- vendor/extensions/clipped-extension/lib/
|
|
1230
|
-
- vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb
|
|
1237
|
+
- vendor/extensions/clipped-extension/lib/tasks/active_storage_tasks.rake
|
|
1231
1238
|
- vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake
|
|
1232
|
-
- vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake
|
|
1233
1239
|
- vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension.rb
|
|
1234
1240
|
- vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb
|
|
1235
1241
|
- vendor/extensions/layouts-extension/layouts_extension.rb
|
|
@@ -1306,14 +1312,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
1306
1312
|
requirements:
|
|
1307
1313
|
- - ">="
|
|
1308
1314
|
- !ruby/object:Gem::Version
|
|
1309
|
-
version: 3.
|
|
1315
|
+
version: 3.3.4
|
|
1310
1316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1311
1317
|
requirements:
|
|
1312
1318
|
- - ">"
|
|
1313
1319
|
- !ruby/object:Gem::Version
|
|
1314
1320
|
version: 1.3.1
|
|
1315
1321
|
requirements: []
|
|
1316
|
-
rubygems_version: 3.
|
|
1322
|
+
rubygems_version: 3.5.11
|
|
1317
1323
|
signing_key:
|
|
1318
1324
|
specification_version: 4
|
|
1319
1325
|
summary: A no-fluff content management system designed for small teams.
|
|
@@ -1352,11 +1358,17 @@ test_files:
|
|
|
1352
1358
|
- spec/dummy/config/storage.yml
|
|
1353
1359
|
- spec/dummy/config.ru
|
|
1354
1360
|
- spec/dummy/db/schema.rb
|
|
1361
|
+
- spec/dummy/log/development.log
|
|
1362
|
+
- spec/dummy/log/test.log
|
|
1355
1363
|
- spec/dummy/package.json
|
|
1356
1364
|
- spec/dummy/public/404.html
|
|
1357
1365
|
- spec/dummy/public/422.html
|
|
1358
1366
|
- spec/dummy/public/500.html
|
|
1359
1367
|
- spec/dummy/public/favicon.ico
|
|
1368
|
+
- spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig
|
|
1369
|
+
- spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime
|
|
1370
|
+
- spec/dummy/tmp/local_secret.txt
|
|
1371
|
+
- spec/dummy/tmp/trusty_config_cache.txt
|
|
1360
1372
|
- spec/dummy/yarn.lock
|
|
1361
1373
|
- spec/factories/layout.rb
|
|
1362
1374
|
- spec/factories/page.rb
|
|
@@ -1369,6 +1381,7 @@ test_files:
|
|
|
1369
1381
|
- spec/fixtures/files/sample.ics
|
|
1370
1382
|
- spec/fixtures/files/sample.txt
|
|
1371
1383
|
- spec/fixtures/users.yml
|
|
1384
|
+
- spec/lib/trusty_cms/geometry_spec.rb
|
|
1372
1385
|
- spec/models/asset_spec.rb
|
|
1373
1386
|
- spec/models/layout_spec.rb
|
|
1374
1387
|
- spec/models/snippets_spec.rb
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require 'active_support'
|
|
2
|
-
|
|
3
|
-
class AssetType
|
|
4
|
-
def paperclip_processors
|
|
5
|
-
deprecation = ActiveSupport::Deprecation.new
|
|
6
|
-
deprecation.warn('Paperclip processors will be deprecated soon in favor of ActiveStorage.')
|
|
7
|
-
|
|
8
|
-
active_storage_styles
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def paperclip_styles
|
|
12
|
-
deprecation = ActiveSupport::Deprecation.new
|
|
13
|
-
deprecation.warn('Paperclip styles will be deprecated soon in favor of ActiveStorage.')
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
module Paperclip
|
|
2
|
-
class FrameGrab < Processor
|
|
3
|
-
|
|
4
|
-
attr_accessor :time_offset, :current_geometry, :target_geometry, :whiny, :current_format, :target_format
|
|
5
|
-
|
|
6
|
-
def initialize(file, options = {}, attachment = nil)
|
|
7
|
-
super
|
|
8
|
-
@file = file
|
|
9
|
-
@time_offset = options[:time_offset] || '-4'
|
|
10
|
-
geometry = options[:geometry]
|
|
11
|
-
unless geometry.blank?
|
|
12
|
-
@crop = geometry[-1,1] == '#'
|
|
13
|
-
@target_geometry = Geometry.parse(geometry)
|
|
14
|
-
@current_geometry = Geometry.parse(video_dimensions(file))
|
|
15
|
-
end
|
|
16
|
-
@current_format = File.extname(@file.path)
|
|
17
|
-
@target_format = options[:format] || 'jpg'
|
|
18
|
-
@basename = File.basename(@file.path, @current_format)
|
|
19
|
-
@whiny = options[:whiny].nil? ? true : options[:whiny]
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def crop?
|
|
23
|
-
!!@crop
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def make
|
|
27
|
-
src = @file
|
|
28
|
-
dst = Tempfile.new([ @basename, @target_format ].compact.join("."))
|
|
29
|
-
dst.binmode
|
|
30
|
-
|
|
31
|
-
begin
|
|
32
|
-
# grab frame at offset
|
|
33
|
-
cmd = %Q[-itsoffset #{time_offset} -i :source -y -vcodec mjpeg -vframes 1 -an -f rawvideo ]
|
|
34
|
-
|
|
35
|
-
# if scale-and-crop parameters can be calculated, we pipe to convert for resizing
|
|
36
|
-
if scale_and_crop = transformation_options
|
|
37
|
-
cmd << %{pipe: | convert #{scale_and_crop} - #{target_format}:- }
|
|
38
|
-
|
|
39
|
-
# otherwise we let ffmpeg resize the to the right size without preserving aspect ratio
|
|
40
|
-
else
|
|
41
|
-
cmd << %{-s #{target_geometry} pipe: }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# then pipe to composite to overlay video icon
|
|
45
|
-
cmd << %{| composite -gravity center :icon - :dest }
|
|
46
|
-
|
|
47
|
-
Paperclip.run('ffmpeg', cmd, :source => File.expand_path(src.path), :dest => File.expand_path(dst.path), :icon => AssetType.find(:video).icon_path, :swallow_stderr => false)
|
|
48
|
-
rescue PaperclipCommandLineError => e
|
|
49
|
-
raise PaperclipError, "There was an error processing the thumbnail for #{@basename}: #{e}" if whiny
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
dst
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# get video dimensions in nasty hacky way
|
|
56
|
-
def video_dimensions(file)
|
|
57
|
-
dim = Paperclip.run('ffmpeg', '-i :source 2>&1', :source => File.expand_path(file.path), :expected_outcodes => [0,1], :swallow_stderr => false)
|
|
58
|
-
$1 if dim =~ /(\d+x\d+)/
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Duplicated from Thumbnail. We can't just subclass because of assumed compatibility with Geometry.from_file
|
|
62
|
-
def transformation_options
|
|
63
|
-
if current_geometry
|
|
64
|
-
scale, crop = current_geometry.transformation_to(target_geometry, crop?)
|
|
65
|
-
trans = []
|
|
66
|
-
trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty?
|
|
67
|
-
trans << "-crop" << %["#{crop}"] << "+repage" if crop
|
|
68
|
-
trans.join(" ")
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
module Paperclip
|
|
2
|
-
|
|
3
|
-
class TransformationError < PaperclipError; end
|
|
4
|
-
class StyleError < PaperclipError; end
|
|
5
|
-
|
|
6
|
-
class Geometry
|
|
7
|
-
|
|
8
|
-
# Returns a new Geometry object with the the same dimensions as this but with no modifier.
|
|
9
|
-
def without_modifier
|
|
10
|
-
Geometry.new(self.width, self.height)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Returns the dimensions that would result if a thumbnail was created by transforming this geometry into that geometry.
|
|
14
|
-
# Its purpose is to mimic imagemagick conversions. Used like so:
|
|
15
|
-
# file_geometry.transformed_by(style_geometry)
|
|
16
|
-
# it returns the size of the thumbnail image you would get by applying that rule.
|
|
17
|
-
# This saves us having to go back to the file, which is expensive with S3.
|
|
18
|
-
# We understand all the Imagemagick geometry arguments described at http://www.imagemagick.org/script/command-line-processing.php#geometry
|
|
19
|
-
# including both '^' and paperclip's own '#' modifier.
|
|
20
|
-
#
|
|
21
|
-
def transformed_by (other)
|
|
22
|
-
other = Geometry.parse(other) unless other.is_a? Geometry
|
|
23
|
-
# if the two geometries are similar, or the destination geometry is a fixed size, the resulting dimensions are fixed
|
|
24
|
-
return other.without_modifier if self =~ other || ['#', '!', '^'].include?(other.modifier)
|
|
25
|
-
# otherwise, we apply the transformation
|
|
26
|
-
raise TransformationError, "geometry is not transformable without both width and height" if self.height == 0 or self.width == 0
|
|
27
|
-
case other.modifier
|
|
28
|
-
when '>'
|
|
29
|
-
(other.width < self.width || other.height < self.height) ? scaled_to_fit(other) : self
|
|
30
|
-
when '<'
|
|
31
|
-
(other.width > self.width && other.height > self.height) ? scaled_to_fit(other) : self
|
|
32
|
-
when '%'
|
|
33
|
-
scaled_by(other)
|
|
34
|
-
when '@'
|
|
35
|
-
scaled_by(other.width * 100 / (self.width * self.height))
|
|
36
|
-
else
|
|
37
|
-
scaled_to_fit(other)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
alias :* :transformed_by
|
|
41
|
-
|
|
42
|
-
# Tests whether two geometries are identical in dimensions and modifier.
|
|
43
|
-
def == (other)
|
|
44
|
-
self.to_s == other.to_s
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# Tests whether two geometries have the same dimensions, ignoring modifier.
|
|
48
|
-
def =~ (other)
|
|
49
|
-
self.height.to_i == other.height.to_i && self.width.to_i == other.width.to_i
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Scales this geometry to fit within that geometry.
|
|
53
|
-
def scaled_to_fit(other)
|
|
54
|
-
if (other.width > 0 && other.height == 0)
|
|
55
|
-
Geometry.new(other.width, self.height * other.width / self.width)
|
|
56
|
-
elsif (other.width == 0 && other.height > 0)
|
|
57
|
-
Geometry.new(self.width * other.height / self.height, other.height)
|
|
58
|
-
else
|
|
59
|
-
ratio = Geometry.new( other.width / self.width, other.height / self.height )
|
|
60
|
-
if ratio.square?
|
|
61
|
-
other.without_modifier
|
|
62
|
-
elsif ratio.horizontal?
|
|
63
|
-
Geometry.new(ratio.height * self.width, other.height)
|
|
64
|
-
else
|
|
65
|
-
Geometry.new(other.width, ratio.width * self.height)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Scales this geometry by the percentage(s) specified in that geometry.
|
|
71
|
-
def scaled_by(other)
|
|
72
|
-
other = Geometry.new("#{other}%") unless other.is_a? Geometry
|
|
73
|
-
if other.height > 0
|
|
74
|
-
Geometry.new(self.width * other.width / 100, self.height * other.height / 100)
|
|
75
|
-
else
|
|
76
|
-
Geometry.new(self.width * other.width / 100, self.height * other.width / 100)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
def obtain_class
|
|
2
|
-
class_name = ENV['CLASS'] || ENV['class']
|
|
3
|
-
raise "Must specify CLASS" unless class_name
|
|
4
|
-
@klass = Object.const_get(class_name)
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def obtain_attachments
|
|
8
|
-
name = ENV['ATTACHMENT'] || ENV['attachment']
|
|
9
|
-
raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions)
|
|
10
|
-
if !name.blank? && @klass.attachment_definitions.keys.include?(name)
|
|
11
|
-
[ name ]
|
|
12
|
-
else
|
|
13
|
-
@klass.attachment_definitions.keys
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def for_all_attachments
|
|
18
|
-
klass = obtain_class
|
|
19
|
-
names = obtain_attachments
|
|
20
|
-
ids = klass.connection.select_values(klass.send(:construct_finder_sql, :select => 'id'))
|
|
21
|
-
|
|
22
|
-
ids.each do |id|
|
|
23
|
-
instance = klass.find(id)
|
|
24
|
-
names.each do |name|
|
|
25
|
-
result = if instance.send("#{ name }?")
|
|
26
|
-
yield(instance, name)
|
|
27
|
-
else
|
|
28
|
-
true
|
|
29
|
-
end
|
|
30
|
-
print result ? "." : "x"; $stdout.flush
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
puts " Done."
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
namespace :paperclip do
|
|
37
|
-
desc "Refreshes both metadata and thumbnails."
|
|
38
|
-
task :refresh => ["paperclip:refresh:metadata", "paperclip:refresh:thumbnails"]
|
|
39
|
-
|
|
40
|
-
namespace :refresh do
|
|
41
|
-
desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)."
|
|
42
|
-
task :thumbnails => :environment do
|
|
43
|
-
errors = []
|
|
44
|
-
for_all_attachments do |instance, name|
|
|
45
|
-
result = instance.send(name).reprocess!
|
|
46
|
-
errors << [instance.id, instance.errors] unless instance.errors.blank?
|
|
47
|
-
result
|
|
48
|
-
end
|
|
49
|
-
errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" }
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)."
|
|
53
|
-
task :metadata => :environment do
|
|
54
|
-
for_all_attachments do |instance, name|
|
|
55
|
-
if file = instance.send(name).to_file
|
|
56
|
-
instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip)
|
|
57
|
-
instance.send("#{name}_content_type=", file.content_type.strip)
|
|
58
|
-
instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size")
|
|
59
|
-
instance.save(false)
|
|
60
|
-
else
|
|
61
|
-
true
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
desc "Cleans out invalid attachments. Useful after you've added new validations."
|
|
68
|
-
task :clean => :environment do
|
|
69
|
-
for_all_attachments do |instance, name|
|
|
70
|
-
instance.send(name).send(:validate)
|
|
71
|
-
if instance.send(name).valid?
|
|
72
|
-
true
|
|
73
|
-
else
|
|
74
|
-
instance.send("#{name}=", nil)
|
|
75
|
-
instance.save
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|