futuresinc-attachment_fu 1.0.5 → 1.0.6

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 5
2
+ :patch: 6
3
3
  :major: 1
4
4
  :minor: 0
@@ -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"
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-06-24}
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
- errors.add attr_name, I18n.translate("activerecord.errors.messages.inclusion", attr_name => enum) unless enum.nil? || enum.include?(send(attr_name))
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
- if file_data.content_type.strip == "application/octet-stream"
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.5
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-06-24 00:00:00 -07:00
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.2.0
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.