futuresinc-attachment_fu 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/attachment_fu.gemspec +2 -2
- data/lib/attachment_fu.rb +8 -6
- metadata +4 -3
data/VERSION.yml
CHANGED
data/attachment_fu.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{attachment_fu}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Technoweenie"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-08-20}
|
10
10
|
s.description = %q{Treat an ActiveRecord model as a file attachment, storing its patch, size, content type, etc.}
|
11
11
|
s.email = %q{github@futuresinc.com}
|
12
12
|
s.extra_rdoc_files = [
|
data/lib/attachment_fu.rb
CHANGED
@@ -445,7 +445,13 @@ module AttachmentFu # :nodoc:
|
|
445
445
|
[:size, :content_type].each do |attr_name|
|
446
446
|
enum = attachment_options[attr_name]
|
447
447
|
if Object.const_defined?(:I18n) # Rails >= 2.2
|
448
|
-
|
448
|
+
unless enum.nil? || enum.include?(send(attr_name))
|
449
|
+
unless attachment_options["#{attr_name.to_s}_validation_message".to_sym].blank?
|
450
|
+
errors.add attr_name, I18n.translate(attachment_options["#{attr_name.to_s}_validation_message".to_sym])
|
451
|
+
else
|
452
|
+
errors.add attr_name, I18n.translate("activerecord.errors.messages.inclusion", attr_name => enum)
|
453
|
+
end
|
454
|
+
end
|
449
455
|
else
|
450
456
|
errors.add attr_name, ActiveRecord::Errors.default_error_messages[:inclusion] unless enum.nil? || enum.include?(send(attr_name))
|
451
457
|
end
|
@@ -527,11 +533,7 @@ module AttachmentFu # :nodoc:
|
|
527
533
|
end
|
528
534
|
|
529
535
|
def detect_mimetype(file_data)
|
530
|
-
|
531
|
-
return File.mime_type?(file_data.original_filename)
|
532
|
-
else
|
533
|
-
return file_data.content_type
|
534
|
-
end
|
536
|
+
File.mime_type?(file_data.original_filename)
|
535
537
|
end
|
536
538
|
end
|
537
539
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: futuresinc-attachment_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Technoweenie
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-20 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- vendor/red_artisan/core_image/processor.rb
|
76
76
|
has_rdoc: true
|
77
77
|
homepage: http://github.com/futuresinc/attachment_fu
|
78
|
+
licenses:
|
78
79
|
post_install_message:
|
79
80
|
rdoc_options:
|
80
81
|
- --charset=UTF-8
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
requirements: []
|
96
97
|
|
97
98
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.3.5
|
99
100
|
signing_key:
|
100
101
|
specification_version: 3
|
101
102
|
summary: Treat an ActiveRecord model as a file attachment, storing its patch, size, content type, etc.
|