refile-mongoid-5 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5b54ae6a53afcd310ca601cfd6ba34a1431ba7cb
4
+ data.tar.gz: dfe2ffa9b159ed8fc9e443c8d27308c6dbf8b2cd
5
+ SHA512:
6
+ metadata.gz: a5ff99db538ddb43df36288594b968e8193a58a0dc65bf5952ff906008c1e538d1acccf893e25f919ef026171c2f3ad3c5f98043f6a64b8e6b912b0048684839
7
+ data.tar.gz: c77238af0bf2b6c0d28242853ecaff0007027a9c8d467dec6f796f6030045e6bffeff8dde005693937210a137c1f326362c2b6b0e1ed6218bc3d2ccf70b79af9
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Janko Marohnić
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # Refile::Mongoid
2
+
3
+ [Mongoid](http://mongoid.org/) extension for [Refile](https://github.com/refile/refile).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'refile-mongoid'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ruby
16
+ require "refile/mongoid"
17
+
18
+ class User
19
+ include Mongoid::Document
20
+ extend Refile::Mongoid::Attachment
21
+
22
+ attachment :profile_image
23
+ end
24
+ ```
25
+
26
+ ## License
27
+
28
+ [MIT](/LICENSE.txt)
@@ -0,0 +1 @@
1
+ require 'refile/mongoid/attachment'
@@ -0,0 +1,33 @@
1
+ require 'refile'
2
+ require 'mongoid'
3
+
4
+ module Refile
5
+ module Mongoid
6
+ module Attachment
7
+ include Refile::Attachment
8
+
9
+ def attachment(name, raise_errors: false, **options)
10
+ super
11
+ attacher = "#{name}_attacher"
12
+ field "#{name}_id".to_sym, type: String
13
+
14
+ before_save do
15
+ send(attacher).store!
16
+ end
17
+
18
+ after_destroy do
19
+ send(attacher).delete!
20
+ end
21
+
22
+ before_validation do
23
+ if send(attacher).present?
24
+ send(attacher).valid?
25
+ send(attacher).errors.each do |error|
26
+ errors.add(name, error)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refile-mongoid-5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carl Retzner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: refile
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mongoid
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mongoid-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: Allow MongoID to play nicely with refile
84
+ email:
85
+ - krettan@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - LICENSE.txt
91
+ - README.md
92
+ - lib/refile/mongoid.rb
93
+ - lib/refile/mongoid/attachment.rb
94
+ homepage: https://github.com/krettan/refile-mongoid
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 2.1.0
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.5.0
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: MongoID integration of the Refile gem
118
+ test_files: []
119
+ has_rdoc: