picture_handler 0.0.1 → 0.0.2

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.
@@ -23,6 +23,8 @@ module PictureHandler
23
23
  def storage_field(column, picture_handler)
24
24
 
25
25
  before_save :picture_store
26
+ after_save :picture_delete_old
27
+
26
28
  before_destroy :picture_delete
27
29
 
28
30
  # Save the COLUMN !
@@ -100,12 +102,11 @@ module PictureHandler
100
102
 
101
103
  end
102
104
 
103
- # Trigger when ActiveRecord Model.save
105
+ # Trigger when ActiveRecord before Model.save
104
106
  def picture_store
105
107
 
106
108
  # Call Model.column field
107
- column = self.class.column.to_s
108
- self.send(column) if @uploader.nil?
109
+ self.send(self.class.column.to_s) if @uploader.nil?
109
110
 
110
111
  # If we are in an already existing record a no remote_path have been given prior to save
111
112
  return if @old_record && self.remote_path.blank?
@@ -119,6 +120,14 @@ module PictureHandler
119
120
 
120
121
  end
121
122
 
123
+ # Trigger when ActiveRecord after Model.save
124
+ def picture_delete_old
125
+
126
+ puts "AFTER_SAVE SUPPRESSION DES FICHIERS DEJA UP !!"
127
+
128
+
129
+ end
130
+
122
131
  end
123
132
 
124
133
  end
@@ -1,7 +1,6 @@
1
1
  module PictureHandler
2
2
  module Uploader
3
3
  module MiniMagick
4
- extend ActiveSupport::Concern
5
4
 
6
5
  def self.included(base)
7
6
  base.extend ClassMethods
@@ -1,3 +1,3 @@
1
1
  module PictureHandler
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picture_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-10 00:00:00.000000000 Z
12
+ date: 2015-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_magick
@@ -96,7 +96,7 @@ files:
96
96
  - MIT-LICENSE
97
97
  - Rakefile
98
98
  - README.rdoc
99
- homepage: http://prettyfuntherapy.com
99
+ homepage: https://github.com/prettyfuntherapy/picture_handler
100
100
  licenses:
101
101
  - MIT
102
102
  post_install_message: