attached 0.3.3 → 0.3.4

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/README.rdoc CHANGED
@@ -4,12 +4,17 @@ Attached is a Ruby on Rails file attachment tool that lets users upload to the c
4
4
 
5
5
  == Requirements
6
6
 
7
- The gem is tested with Ruby 1.9.2 and Rails 3.0.5 but may well work with other versions of Ruby and Rails.
7
+ The gem is tested with Ruby 1.9.2 and Rails 3.0.6 but may well work with other versions of Ruby and Rails.
8
8
 
9
9
  == Installation
10
10
 
11
11
  gem install attached
12
-
12
+
13
+ == Optional
14
+
15
+ brew install imagemagick
16
+ port install imagemagick
17
+
13
18
  == Examples
14
19
 
15
20
  Migration:
@@ -37,8 +42,8 @@ Model:
37
42
 
38
43
  has_attached :encoding, :styles => {
39
44
  :webm => { :extension => '.webm' },
40
- :mp4 => { :extension => '.mp4' },
41
- :ogv => { :extension => '.ogv' },
45
+ :mp4 => { :extension => '.mp4' },
46
+ :ogv => { :extension => '.ogv' },
42
47
  }
43
48
 
44
49
  after_save do
data/lib/attached.rb CHANGED
@@ -154,6 +154,7 @@ module Attached
154
154
  #
155
155
  # Usage:
156
156
  #
157
+ # validates_attached_extension :avatar, :is => 'png'
157
158
  # validates_attached_extension :avatar, :in => %w(png jpg)
158
159
  # validates_attached_extension :avatar, :in => [:png, :jpg]
159
160
  # validates_attached_extension :avatar, :in => %w(png jpg), :message => "extension must be :in"
@@ -163,6 +164,8 @@ module Attached
163
164
 
164
165
  message = options[:message]
165
166
  message ||= "extension is invalid"
167
+
168
+ options[:in] ||= [options[:is]] if options[:is]
166
169
 
167
170
  range = options[:in].map { |element| ".#{element}" }
168
171
 
@@ -106,6 +106,13 @@ module Attached
106
106
  instance.changed.include? "#{name}_identifier"
107
107
  end
108
108
 
109
+
110
+ # Check if an attachment is present.
111
+ #
112
+ # Usage:
113
+ #
114
+ # @object.avatar.file?
115
+
109
116
  def file?
110
117
  not identifier.blank?
111
118
  end
@@ -1,3 +1,3 @@
1
1
  module Attached
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: attached
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.3
5
+ version: 0.3.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Sylvestre
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-16 00:00:00 -04:00
14
- default_executable:
13
+ date: 2011-04-13 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: fog
@@ -66,7 +65,6 @@ files:
66
65
  - LICENSE
67
66
  - Gemfile
68
67
  - Rakefile
69
- has_rdoc: true
70
68
  homepage: http://github.com/ksylvest/attached
71
69
  licenses: []
72
70
 
@@ -90,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
88
  requirements: []
91
89
 
92
90
  rubyforge_project:
93
- rubygems_version: 1.6.2
91
+ rubygems_version: 1.7.2
94
92
  signing_key:
95
93
  specification_version: 3
96
94
  summary: An attachment library designed with cloud processors in mind