mongoid-paperclip 0.0.7 → 0.0.8
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/.gitignore +3 -1
- data/LICENSE +21 -0
- data/README.md +25 -1
- data/lib/mongoid_paperclip.rb +0 -14
- data/mongoid-paperclip.gemspec +1 -1
- metadata +12 -5
data/.gitignore
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) Michael van Rooijen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.md
CHANGED
@@ -70,10 +70,34 @@ Just like Paperclip, Mongoid::Paperclip takes a second argument (hash of options
|
|
70
70
|
<%= picture.attachment.url %>
|
71
71
|
end
|
72
72
|
|
73
|
+
Note on embedded documents: if you plan to save or update the parent document, you MUST add cascade_callbacks: true to your
|
74
|
+
embeds_XXX statement. Otherwise, your data will be updated but the paperclip functions will not run to copy/update your file.
|
75
|
+
|
76
|
+
In the above example:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
class User
|
80
|
+
...
|
81
|
+
embeds_many :pictures, :cascade_callbacks => true
|
82
|
+
accepts_nested_attributes_for :pictures, ...
|
83
|
+
attr_accepted :pictures_attributes, ...
|
84
|
+
...
|
85
|
+
end
|
86
|
+
|
87
|
+
@user.update_attributes({ ... :pictures => [...] })
|
88
|
+
```
|
89
|
+
|
73
90
|
|
74
91
|
There you go
|
75
92
|
------------
|
76
93
|
|
77
94
|
Quite a lot of people have been looking for a solution to use Paperclip with Mongoid so I hope this helps!
|
78
95
|
|
79
|
-
If you need more information on either [Mongoid](http://mongoid.org/) or [Paperclip](https://github.com/thoughtbot/paperclip) I suggest checking our their official documentation and website.
|
96
|
+
If you need more information on either [Mongoid](http://mongoid.org/) or [Paperclip](https://github.com/thoughtbot/paperclip) I suggest checking our their official documentation and website.
|
97
|
+
|
98
|
+
|
99
|
+
License
|
100
|
+
-------
|
101
|
+
|
102
|
+
Mongoid::Paperclip is released under the MIT license. See LICENSE for more information.
|
103
|
+
|
data/lib/mongoid_paperclip.rb
CHANGED
@@ -7,20 +7,6 @@ rescue LoadError
|
|
7
7
|
exit
|
8
8
|
end
|
9
9
|
|
10
|
-
##
|
11
|
-
# Use mongoid's logger.
|
12
|
-
module Paperclip
|
13
|
-
class << self
|
14
|
-
def logger
|
15
|
-
if Mongoid::Config.logger.present?
|
16
|
-
Mongoid::Config.logger
|
17
|
-
else
|
18
|
-
Rails.logger
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
10
|
##
|
25
11
|
# the id of mongoid is not integer, correct the id_partitioin.
|
26
12
|
Paperclip.interpolates :id_partition do |attachment, style|
|
data/mongoid-paperclip.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: paperclip
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 2.3.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.3.6
|
25
30
|
description: Mongoid::Paperclip enables you to use Paperclip with the Mongoid ODM
|
26
31
|
for MongoDB.
|
27
32
|
email: meskyanichi@gmail.com
|
@@ -30,6 +35,7 @@ extensions: []
|
|
30
35
|
extra_rdoc_files: []
|
31
36
|
files:
|
32
37
|
- .gitignore
|
38
|
+
- LICENSE
|
33
39
|
- README.md
|
34
40
|
- lib/mongoid_paperclip.rb
|
35
41
|
- mongoid-paperclip.gemspec
|
@@ -53,9 +59,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
59
|
version: '0'
|
54
60
|
requirements: []
|
55
61
|
rubyforge_project:
|
56
|
-
rubygems_version: 1.8.
|
62
|
+
rubygems_version: 1.8.24
|
57
63
|
signing_key:
|
58
64
|
specification_version: 3
|
59
65
|
summary: Mongoid::Paperclip enables you to use Paperclip with the Mongoid ODM for
|
60
66
|
MongoDB.
|
61
67
|
test_files: []
|
68
|
+
has_rdoc:
|