simple_form_attachments 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75d8e9396efb588b4dffa12c91aeba4416933ea4
4
- data.tar.gz: d397b0c78369aafb384aec012b86878c106d2a0e
3
+ metadata.gz: 7eacf3010000eaf619be4b2df36081e9f9ec843c
4
+ data.tar.gz: 660027abe7942ff8aecc744911d87af924f96dd8
5
5
  SHA512:
6
- metadata.gz: 7e25e24f7adb571ffe350168aae72539d2cb2205e021b9cdc2e42d331cb469fd10eab49ace5c85ac91eca5e8ea52b8df6cd9caf08272e8204ed3846edcac6582
7
- data.tar.gz: f765ad02d7674232ad72ceded36afabea16a8b0e91376cfdaf18c822653c5b0cb444a0be784b008c32d01a23f488f89592e68114cba31973ff035a89d5fc00f6
6
+ metadata.gz: 241e0495e78fd53bf8719128ae8ff21d9d7bc46377565ff5c7f37b511e04c2641dc818352f2d6e23bd44cb6a9b4883e92ebf2078e17502fbb39109610429b486
7
+ data.tar.gz: ad219c71014effa1e50764dc8060af86ebdcb0c2e95b47d89da2f67b235b73626b280d69715ff969148b831b18c5696b6232c80a303eeda9635b96a9e811389f
data/.bundle/config ADDED
@@ -0,0 +1 @@
1
+ --- {}
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_attachments (0.2.3)
4
+ simple_form_attachments (0.2.4)
5
5
  jquery-ui-rails
6
6
  rails (>= 4.2)
7
7
  rails-assets-blueimp-file-upload (>= 9.6.0)
@@ -53,7 +53,7 @@ GEM
53
53
  bson (3.2.6)
54
54
  builder (3.2.2)
55
55
  coderay (1.1.0)
56
- concurrent-ruby (1.0.1)
56
+ concurrent-ruby (1.0.2)
57
57
  connection_pool (2.2.0)
58
58
  coveralls (0.8.10)
59
59
  json (~> 1.8)
@@ -100,8 +100,8 @@ GEM
100
100
  loofah (2.0.3)
101
101
  nokogiri (>= 1.5.9)
102
102
  lumberjack (1.0.9)
103
- mail (2.6.3)
104
- mime-types (>= 1.16, < 3)
103
+ mail (2.6.4)
104
+ mime-types (>= 1.16, < 4)
105
105
  method_source (0.8.2)
106
106
  mime-types (2.99)
107
107
  mini_portile2 (2.0.0)
@@ -147,15 +147,15 @@ GEM
147
147
  railties (= 4.2.5)
148
148
  sprockets-rails
149
149
  rails-assets-blueimp-canvas-to-blob (3.3.0)
150
- rails-assets-blueimp-file-upload (9.12.1)
150
+ rails-assets-blueimp-file-upload (9.12.3)
151
151
  rails-assets-blueimp-canvas-to-blob (>= 2.1.1)
152
152
  rails-assets-blueimp-load-image (>= 1.13.0)
153
153
  rails-assets-blueimp-tmpl (>= 2.5.4)
154
154
  rails-assets-jquery (>= 1.6)
155
155
  rails-assets-blueimp-load-image (2.6.1)
156
- rails-assets-blueimp-tmpl (3.3.0)
156
+ rails-assets-blueimp-tmpl (3.4.0)
157
157
  rails-assets-handlebars (4.0.5)
158
- rails-assets-jquery (2.2.2)
158
+ rails-assets-jquery (2.2.4)
159
159
  rails-deprecated_sanitizer (1.0.3)
160
160
  activesupport (>= 4.2.0.alpha)
161
161
  rails-dom-testing (1.0.7)
@@ -186,23 +186,23 @@ GEM
186
186
  json (~> 1.8)
187
187
  simplecov-html (~> 0.10.0)
188
188
  simplecov-html (0.10.0)
189
- slim (3.0.6)
190
- temple (~> 0.7.3)
189
+ slim (3.0.7)
190
+ temple (~> 0.7.6)
191
191
  tilt (>= 1.3.3, < 2.1)
192
192
  slop (3.6.0)
193
- sprockets (3.5.2)
193
+ sprockets (3.6.3)
194
194
  concurrent-ruby (~> 1.0)
195
195
  rack (> 1, < 3)
196
196
  sprockets-rails (3.0.4)
197
197
  actionpack (>= 4.0)
198
198
  activesupport (>= 4.0)
199
199
  sprockets (>= 3.0.0)
200
- temple (0.7.6)
200
+ temple (0.7.7)
201
201
  term-ansicolor (1.3.2)
202
202
  tins (~> 1.0)
203
203
  thor (0.19.1)
204
204
  thread_safe (0.3.5)
205
- tilt (2.0.2)
205
+ tilt (2.0.5)
206
206
  tins (1.6.0)
207
207
  tzinfo (1.2.2)
208
208
  thread_safe (~> 0.1)
@@ -226,4 +226,4 @@ DEPENDENCIES
226
226
  simple_form_attachments!
227
227
 
228
228
  BUNDLED WITH
229
- 1.11.2
229
+ 1.12.1
@@ -1,33 +1,36 @@
1
1
  module SimpleFormAttachments
2
2
  class UploadController < ActionController::Base
3
+ def show
4
+ @attachment = attachment_class.find(params[:id])
5
+ render json: { html: attachment_html(@attachment) }, status: :ok
6
+ end
7
+
3
8
  def create
4
- res = attachment.save
5
- render json: attachment_json, status: (res ? :ok : :unprocessable_entity)
9
+ @attachment = new_attachment
10
+ res = @attachment.save
11
+ render json: { html: attachment_html(@attachment) }, status: (res ? :ok : :unprocessable_entity)
6
12
  end
7
13
 
8
14
  private # =============================================================
9
15
 
10
- def attachment
11
- @attachment ||= attachment_class.new({ temporary: true }.merge(attachment_params))
12
- end
13
-
14
- def attachment_json
15
- { html: attachment_html }
16
+ def new_attachment
17
+ attachment_class.new(attachment_params).tap do |att|
18
+ att.temporary = true
19
+ end
16
20
  end
17
21
 
18
- def attachment_html
19
- render_to_string partial: 'simple_form_attachments/attachment_upload_template', locals: partial_locals
22
+ def attachment_html(attachment)
23
+ render_to_string(partial: 'simple_form_attachments/attachment_upload_template', locals: partial_locals.merge(attachment: attachment))
20
24
  end
21
25
 
22
26
  def partial_locals
23
27
  {
24
- parent: parent,
25
- parent_name: parent_name,
26
- parent_class: parent_class,
28
+ attachment_relation: attachment_relation,
27
29
  child_index: child_index,
28
- attachment: attachment,
29
30
  multiple: multiple?,
30
- attachment_relation: params[:attachment_relation]
31
+ parent: parent,
32
+ parent_class: parent_class,
33
+ parent_name: parent_name
31
34
  }
32
35
  end
33
36
 
@@ -35,40 +38,59 @@ module SimpleFormAttachments
35
38
  params.require(:attachment).permit!
36
39
  end
37
40
 
38
- def parent_name
39
- params[:attachment_parent][:name]
41
+ def attachment_class
42
+ params.fetch(:attachment_type).constantize
40
43
  end
41
44
 
42
- def attachment_class
43
- params[:attachment_type].constantize
45
+ def attachment_relation
46
+ params.fetch(:attachment_relation, {})
44
47
  end
45
48
 
46
- def parent_class
47
- return unless params[:attachment_parent]
48
- params[:attachment_parent][:class].constantize
49
+ def attachment_relation_name
50
+ return unless attachment_relation.present?
51
+ attachment_relation.fetch(:name).to_sym
49
52
  end
50
53
 
51
- def parent
52
- return unless params[:attachment_relation]
53
- if multiple? && attachment.errors.empty?
54
- parent_class.new { |o| o.send(params.fetch(:attachment_relation).fetch(:name).to_sym) << attachment }
55
- else
56
- parent_class.new
57
- end
54
+ def attachment_relation_key
55
+ return unless attachment_relation.present?
56
+ attachment_relation.fetch(:key).to_sym
58
57
  end
59
58
 
60
59
  def child_index
61
60
  DateTime.now.strftime('%Q').to_i
62
61
  end
63
62
 
64
- # ---------------------------------------------------------------------
63
+ def multiple_from_params
64
+ attachment_relation.fetch(:multiple, false)
65
+ end
65
66
 
66
67
  def multiple?
67
- ['true', true, '1', 1].include? params.fetch(:attachment_relation, {}).fetch(:multiple, false)
68
+ ['true', true, '1', 1].include?(multiple_from_params)
69
+ end
70
+
71
+ def referenced_from_params
72
+ attachment_relation.fetch(:referenced, false)
68
73
  end
69
74
 
70
75
  def referenced?
71
- ['true', true, '1', 1].include? params.fetch(:attachment_relation, {}).fetch(:referenced, false)
76
+ ['true', true, '1', 1].include?(referenced_from_params)
77
+ end
78
+
79
+ def parent
80
+ return unless attachment_relation_name.present?
81
+ parent_class.new
82
+ end
83
+
84
+ def attachment_parent
85
+ params.fetch(:attachment_parent, {})
86
+ end
87
+
88
+ def parent_class
89
+ attachment_parent.fetch(:class, nil).safe_constantize
90
+ end
91
+
92
+ def parent_name
93
+ attachment_parent.fetch(:name, nil)
72
94
  end
73
95
  end
74
96
  end
@@ -5,8 +5,6 @@ module SimpleFormAttachments
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- include Mongoid::Document
9
-
10
8
  field :temporary, type: Boolean, default: false
11
9
 
12
10
  scope :temporary, -> { where(temporary: true) }
@@ -1,5 +1,4 @@
1
1
  - form = ActionView::Helpers::FormBuilder.new(parent_name, parent, self, {})
2
-
3
2
  = form.simple_fields_for attachment_relation[:name].to_sym, attachment, { child_index: child_index } do |fields|
4
3
  - partial_locals = { attachment: attachment, form: form, fields: fields, multiple: multiple, relation_key: attachment_relation[:key] }
5
4
  - partial_layout = 'layouts/simple_form_attachments/attachment_layout'
data/config/routes.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  SimpleFormAttachments::Engine.routes.draw do
2
2
  scope module: :simple_form_attachments do
3
- post "/attachments" => "upload#create", as: :attachments
3
+ get "attachments/:id" => "upload#show", as: :attachment
4
+ post "attachments" => "upload#create", as: :attachments
4
5
  end
5
6
  end
@@ -3,7 +3,6 @@ require 'i18n'
3
3
 
4
4
  module SimpleFormAttachments
5
5
  class AttachmentInput < SimpleForm::Inputs::Base
6
-
7
6
  class << self
8
7
  attr_accessor :configuration
9
8
 
@@ -19,7 +18,7 @@ module SimpleFormAttachments
19
18
 
20
19
  # =====================================================================
21
20
 
22
- def input wrapper_options
21
+ def input(wrapper_options)
23
22
  template.content_tag :div, merge_wrapper_options(input_html_options, wrapper_options) do
24
23
  template.concat attachment_blank_field
25
24
  template.concat attachment_file_field
@@ -102,17 +101,17 @@ module SimpleFormAttachments
102
101
 
103
102
  def multiple?
104
103
  return false unless relation
105
- !!(relation.macro =~ /many\z/)
104
+ !!relation.macro.to_s.end_with?('many')
106
105
  end
107
106
 
108
107
  def referenced?
109
108
  return false unless relation
110
- !!(relation_class =~ /Referenced\z/)
109
+ !!relation_class.to_s.end_with?('Referenced')
111
110
  end
112
111
 
113
112
  def embedded?
114
113
  return false unless relation
115
- !!(relation_class =~ /Embedded\z/)
114
+ !!relation_class.to_s.end_with?('Embedded')
116
115
  end
117
116
 
118
117
  def sortable?
@@ -123,7 +122,7 @@ module SimpleFormAttachments
123
122
 
124
123
  def attachments
125
124
  return @builder.object.send(attribute_name).to_a unless multiple?
126
- @builder.object.send(attribute_name).sort_by{ |a| @builder.object.send(relation_key).index(a.id) }
125
+ @builder.object.send(attribute_name).sort_by { |a| @builder.object.send(relation_key).index(a.id) }
127
126
  end
128
127
 
129
128
  def accepted_file_types
@@ -141,14 +140,14 @@ module SimpleFormAttachments
141
140
  return unless validators
142
141
  return unless file_validation_values_for(:ext)
143
142
  extensions = file_validation_values_for(:ext)
144
- extensions.map{ |e| ".#{e}" }
143
+ extensions.map { |e| ".#{e}" }
145
144
  end
146
145
 
147
146
  def validated_formats
148
147
  return unless validators
149
148
  return unless file_validation_values_for(:format)
150
149
  formats = file_validation_values_for(:format)
151
- formats.map{ |f| ".#{f}" }
150
+ formats.map { |f| ".#{f}" }
152
151
  end
153
152
 
154
153
  def validated_mime_types
@@ -158,18 +157,18 @@ module SimpleFormAttachments
158
157
  mime_types
159
158
  end
160
159
 
161
- def file_validation_values_for property
160
+ def file_validation_values_for(property)
162
161
  return unless file_validation_for(property)
163
162
  validation = file_validation_for(property)
164
- validation.map{ |v| v.options.values_at(:as, :in) }.flatten.reject(&:blank?).uniq
163
+ validation.map { |v| v.options.values_at(:as, :in) }.flatten.reject(&:blank?).uniq
165
164
  end
166
165
 
167
- def file_validation_for property
166
+ def file_validation_for(property)
168
167
  return unless validators
169
- validators.select{ |v| v.options[:property_name].to_s == property.to_s }
168
+ validators.select { |v| v.options[:property_name].to_s == property.to_s }
170
169
  end
171
170
 
172
- def validators(field=:file)
171
+ def validators(field = :file)
173
172
  relation_class_name.constantize.validators_on(field)
174
173
  end
175
174
 
@@ -187,7 +186,7 @@ module SimpleFormAttachments
187
186
  input_html_options = {
188
187
  multiple: multiple?,
189
188
  accept: accepted_file_types,
190
- class: 'file',
189
+ class: 'file'
191
190
  }
192
191
  template.label_tag('attachment[file]') do
193
192
  template.file_field_tag('attachment[file]', input_html_options)
@@ -233,14 +232,16 @@ module SimpleFormAttachments
233
232
  table_classes << 'sortable' if sortable?
234
233
  template.content_tag :table, class: table_classes do
235
234
  @builder.simple_fields_for attribute_name do |attachment_fields|
236
- template.render partial: "simple_form_attachments/#{attachment_fields.object.to_partial_path}", format: :html, layout: 'layouts/simple_form_attachments/attachment_layout',
235
+ template.render(
236
+ partial: "simple_form_attachments/#{attachment_fields.object.to_partial_path}", format: :html, layout: 'layouts/simple_form_attachments/attachment_layout',
237
237
  locals: {
238
238
  attachment: attachment_fields.object,
239
239
  fields: attachment_fields,
240
240
  multiple: multiple?,
241
241
  form: @builder,
242
- relation_key: relation_key,
242
+ relation_key: relation_key
243
243
  }
244
+ )
244
245
  end
245
246
  end
246
247
  end
@@ -252,6 +253,5 @@ module SimpleFormAttachments
252
253
  template.render('simple_form_attachments/attachments/attachment.hbs.slim')
253
254
  end
254
255
  end
255
-
256
256
  end
257
257
  end
@@ -1,11 +1,9 @@
1
1
  module SimpleFormAttachments
2
2
  class Configuration
3
-
4
3
  attr_accessor :route
5
4
 
6
5
  def route
7
6
  @route ||= SimpleFormAttachments::Engine.routes.url_helpers.attachments_path
8
7
  end
9
-
10
8
  end
11
9
  end
@@ -1,9 +1,8 @@
1
1
  module SimpleFormAttachments
2
2
  class Engine < ::Rails::Engine
3
-
4
3
  engine_name = :simple_form_attachments
5
4
 
6
5
  # Add yml files to I18n
7
- I18n.load_path += Dir[ SimpleFormAttachments::Engine.root.join('config', 'locales', '**', '*.{rb,yml}') ]
6
+ I18n.load_path += Dir[SimpleFormAttachments::Engine.root.join('config', 'locales', '**', '*.{rb,yml}')]
8
7
  end
9
8
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormAttachments
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -4,34 +4,32 @@ require_relative '../../../app/controllers/simple_form_attachments/upload_contro
4
4
 
5
5
  module SimpleFormAttachments
6
6
  describe UploadController do
7
-
8
7
  setup do
9
8
  @routes = SimpleFormAttachments::Engine.routes
10
9
  end
11
10
 
12
- let(:params) {
13
- {
14
- attachment: { body: 'foo' },
15
- attachment_parent: { class: 'Parent' },
16
- attachment_relation: { name: 'attachments', multiple: true },
17
- attachment_type: "Attachment"
18
- }
19
- }
20
- let(:count) { Attachment.count }
21
- let(:action) { post :create, params }
11
+ let(:count) { AttachmentTest.count }
22
12
 
23
13
  # ---------------------------------------------------------------------
24
14
 
25
15
  describe '#create' do
16
+ let(:params) do
17
+ {
18
+ attachment: { body: 'foo' },
19
+ attachment_parent: { class: 'Parent' },
20
+ attachment_relation: { name: 'attachments', multiple: true },
21
+ attachment_type: 'AttachmentTest'
22
+ }
23
+ end
24
+ let(:action) { post :create, params }
25
+
26
26
  it 'should succeed' do
27
27
  action
28
28
  must_respond_with :success
29
29
  end
30
30
 
31
31
  it 'should create attachment of specified model' do
32
- assert_difference '::Attachment.count' do
33
- action
34
- end
32
+ assert_difference('AttachmentTest.count') { action }
35
33
  end
36
34
 
37
35
  it 'must mark the newly upladed attachment as temporary' do
@@ -48,5 +46,32 @@ module SimpleFormAttachments
48
46
  end
49
47
  end
50
48
  end
49
+
50
+ # ---------------------------------------------------------------------
51
+
52
+ describe '#show' do
53
+ let(:attachment) { AttachmentTest.create! }
54
+ let(:params) do
55
+ {
56
+ id: attachment.id.to_s,
57
+ attachment_parent: { class: 'Parent' },
58
+ attachment_relation: { name: 'attachments', multiple: true },
59
+ attachment_type: 'AttachmentTest'
60
+ }
61
+ end
62
+ let(:action) { get :show, params }
63
+
64
+ it 'should succeed' do
65
+ action
66
+ must_respond_with :success
67
+ end
68
+
69
+ describe 'returned JSON' do
70
+ it 'should contain template with correct locals' do
71
+ action
72
+ assert_template 'simple_form_attachments/_attachment_upload_template', locals: { multiple: true, parent_class: params[:attachment_parent][:class].constantize }
73
+ end
74
+ end
75
+ end
51
76
  end
52
77
  end
@@ -1,9 +1,9 @@
1
1
  require 'test_helper'
2
2
  require_relative '../../../../app/models/concerns/simple_form_attachments/attachment'
3
3
 
4
- describe Attachment do
5
- let(:temporary_attachment) { Attachment.new(temporary: true) }
6
- let(:permanent_attachment) { Attachment.new }
4
+ describe AttachmentTest do
5
+ let(:temporary_attachment) { AttachmentTest.new(temporary: true) }
6
+ let(:permanent_attachment) { AttachmentTest.new }
7
7
 
8
8
  before do
9
9
  temporary_attachment.save
@@ -13,29 +13,29 @@ describe Attachment do
13
13
  describe 'scopes' do
14
14
  describe ':temporary' do
15
15
  it 'has :temporary scope' do
16
- Attachment.must_respond_to :temporary
16
+ AttachmentTest.must_respond_to :temporary
17
17
  end
18
18
 
19
19
  it 'returns the temporary attachments' do
20
- Attachment.temporary.to_a.must_include temporary_attachment
20
+ AttachmentTest.temporary.to_a.must_include temporary_attachment
21
21
  end
22
22
 
23
23
  it 'does not return the temporary attachments for' do
24
- Attachment.temporary.to_a.wont_include permanent_attachment
24
+ AttachmentTest.temporary.to_a.wont_include permanent_attachment
25
25
  end
26
26
  end
27
27
 
28
28
  describe ':permanent' do
29
29
  it 'has :permanent scope' do
30
- Attachment.must_respond_to :permanent
30
+ AttachmentTest.must_respond_to :permanent
31
31
  end
32
32
 
33
33
  it 'returns the permanent attachments' do
34
- Attachment.permanent.to_a.must_include permanent_attachment
34
+ AttachmentTest.permanent.to_a.must_include permanent_attachment
35
35
  end
36
36
 
37
37
  it 'does not return the temporary attachments for' do
38
- Attachment.permanent.to_a.wont_include temporary_attachment
38
+ AttachmentTest.permanent.to_a.wont_include temporary_attachment
39
39
  end
40
40
  end
41
41
  end
@@ -7,9 +7,9 @@ describe Parent do
7
7
  let(:attachment_reflection) { parent.reflect_on_association(:attachment) }
8
8
  let(:attachments_reflection) { parent.reflect_on_association(:attachments) }
9
9
 
10
- let(:related_attachment_one) { Attachment.create(temporary: true) }
11
- let(:related_attachment_two) { Attachment.create(temporary: true) }
12
- let(:unrelated_attachment) { Attachment.create(temporary: true) }
10
+ let(:related_attachment_one) { AttachmentTest.create(temporary: true) }
11
+ let(:related_attachment_two) { AttachmentTest.create(temporary: true) }
12
+ let(:unrelated_attachment) { AttachmentTest.create(temporary: true) }
13
13
 
14
14
  # ---------------------------------------------------------------------
15
15
 
@@ -25,7 +25,7 @@ describe Parent do
25
25
  end
26
26
 
27
27
  it 'respects definition of :class_name' do
28
- attachments_reflection.class_name.must_equal 'Attachment'
28
+ attachments_reflection.class_name.must_equal 'AttachmentTest'
29
29
  end
30
30
 
31
31
  it 'passes the :dependent option to the relation' do
@@ -49,7 +49,7 @@ describe Parent do
49
49
  parent.must_respond_to :attachment
50
50
  end
51
51
  it 'respects definition of :class_name' do
52
- attachment_reflection.class_name.must_equal 'Attachment'
52
+ attachment_reflection.class_name.must_equal 'AttachmentTest'
53
53
  end
54
54
  it 'passes the :dependent option to the relation' do
55
55
  attachments_reflection.dependent.must_equal :destroy
@@ -85,11 +85,13 @@ describe Parent do
85
85
  before do
86
86
  parent.attachments << related_attachment_one
87
87
  end
88
+
88
89
  it 'marks has_many attachments as permanent' do
89
90
  related_attachment_one.reload.temporary.must_equal true
90
91
  parent.send(:mark_attachments_permanent)
91
92
  related_attachment_one.reload.temporary.must_equal false
92
93
  end
94
+
93
95
  it 'does not mark other attachments as permanent' do
94
96
  unrelated_attachment.temporary.must_equal true
95
97
  end
@@ -99,15 +101,15 @@ describe Parent do
99
101
  before do
100
102
  parent.attachment = related_attachment_two
101
103
  end
104
+
102
105
  it 'marks has_many attachments as permanent' do
103
106
  related_attachment_two.reload.temporary.must_equal true
104
107
  parent.send(:mark_attachment_permanent)
105
108
  related_attachment_two.reload.temporary.must_equal false
106
109
  end
110
+
107
111
  it 'does not mark other attachments as permanent' do
108
112
  unrelated_attachment.temporary.must_equal true
109
113
  end
110
114
  end
111
-
112
- # ---------------------------------------------------------------------
113
115
  end
data/test/test_helper.rb CHANGED
@@ -52,7 +52,8 @@ end
52
52
 
53
53
  # ---------------------------------------------------------------------
54
54
 
55
- class Attachment
55
+ class AttachmentTest
56
+ include Mongoid::Document
56
57
  include SimpleFormAttachments::Attachment
57
58
  field :body, type: String
58
59
  end
@@ -61,6 +62,6 @@ class Parent
61
62
  include Mongoid::Document
62
63
  include SimpleFormAttachments::HasAttachments
63
64
 
64
- has_one_attachment :attachment, class_name: 'Attachment', dependent: :destroy
65
- has_many_attachments :attachments, class_name: 'Attachment', dependent: :destroy
65
+ has_one_attachment :attachment, class_name: 'AttachmentTest', dependent: :destroy
66
+ has_many_attachments :attachments, class_name: 'AttachmentTest', dependent: :destroy
66
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_attachments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-23 00:00:00.000000000 Z
12
+ date: 2016-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -230,6 +230,7 @@ executables: []
230
230
  extensions: []
231
231
  extra_rdoc_files: []
232
232
  files:
233
+ - ".bundle/config"
233
234
  - ".coveralls.yml"
234
235
  - ".gitignore"
235
236
  - ".travis.yml"