beef-has_assets 0.2.9 → 0.2.10

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.10
data/has_assets.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{has_assets}
5
- s.version = "0.2.9"
5
+ s.version = "0.2.10"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steve England"]
@@ -49,7 +49,6 @@ Gem::Specification.new do |s|
49
49
  "lib/has_assets/custom_redcloth_tags.rb",
50
50
  "lib/has_assets/flash_sesion_cookie_middleware.rb",
51
51
  "lib/has_assets/geometry_crop.rb",
52
- "lib/has_assets/has_assets.rb",
53
52
  "lib/has_assets/imagescience_crop.rb",
54
53
  "lib/has_assets/swfupload.rb",
55
54
  "rails/init.rb",
data/lib/has_assets.rb CHANGED
@@ -1,7 +1,28 @@
1
- require 'has_assets/custom_redcloth_tags'
2
- require 'has_assets/flash_sesion_cookie_middleware'
3
- require 'has_assets/geometry_crop'
4
- require 'has_assets/has_assets'
5
- require 'has_assets/imagescience_crop'
6
- require 'has_assets/swfupload'
7
-
1
+ module Beef
2
+ module Has
3
+ module Assets
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def has_assets
10
+ has_many :assetings, :as => :assetable, :dependent => :delete_all
11
+ has_many :assets, :through => :assetings, :order => 'assetings.id'
12
+
13
+ # Override the default asset_ids method
14
+ define_method("asset_ids=") do |new_value|
15
+ ids = (new_value || []).reject { |nid| nid.blank? }
16
+ ids.collect!{ |id| id.to_i}
17
+ logger.debug "ASSETS the same #{ids == self.asset_ids} | IDS #{ids} | #{self.asset_ids}"
18
+ return if ids == self.asset_ids
19
+ self.assets.clear
20
+ ids.each_index do |idx|
21
+ self.assets << Asset.find(ids[idx])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
data/rails/init.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'has_assets/flash_sesion_cookie_middleware'
2
- require 'has_assets/geometry_crop'
3
- require 'has_assets/has_assets'
4
2
  require 'has_assets/imagescience_crop'
3
+ require 'has_assets/geometry_crop'
5
4
  require 'has_assets/swfupload'
6
5
 
7
6
  config.to_prepare do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-has_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve England
@@ -59,7 +59,6 @@ files:
59
59
  - lib/has_assets/custom_redcloth_tags.rb
60
60
  - lib/has_assets/flash_sesion_cookie_middleware.rb
61
61
  - lib/has_assets/geometry_crop.rb
62
- - lib/has_assets/has_assets.rb
63
62
  - lib/has_assets/imagescience_crop.rb
64
63
  - lib/has_assets/swfupload.rb
65
64
  - rails/init.rb
@@ -1,28 +0,0 @@
1
- module Beef
2
- module Has
3
- module Assets
4
- def self.included(base)
5
- base.extend ClassMethods
6
- end
7
-
8
- module ClassMethods
9
- def has_assets
10
- has_many :assetings, :as => :assetable, :dependent => :delete_all
11
- has_many :assets, :through => :assetings, :order => 'assetings.id'
12
-
13
- # Override the default asset_ids method
14
- define_method("asset_ids=") do |new_value|
15
- ids = (new_value || []).reject { |nid| nid.blank? }
16
- ids.collect!{ |id| id.to_i}
17
- logger.debug "ASSETS the same #{ids == self.asset_ids} | IDS #{ids} | #{self.asset_ids}"
18
- return if ids == self.asset_ids
19
- self.assets.clear
20
- ids.each_index do |idx|
21
- self.assets << Asset.find(ids[idx])
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end