pager-acts_as_paranoid 1.0.20080506 → 1.0.20080507

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1,30 @@
1
- require 'pager-acts_as_paranoid'
1
+ class << ActiveRecord::Base
2
+ def belongs_to_with_deleted(association_id, options = {})
3
+ with_deleted = options.delete :with_deleted
4
+ returning belongs_to_without_deleted(association_id, options) do
5
+ if with_deleted
6
+ reflection = reflect_on_association(association_id)
7
+ association_accessor_methods(reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
8
+ association_constructor_method(:build, reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
9
+ association_constructor_method(:create, reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
10
+ end
11
+ end
12
+ end
13
+
14
+ def has_many_without_deleted(association_id, options = {}, &extension)
15
+ with_deleted = options.delete :with_deleted
16
+ returning has_many_with_deleted(association_id, options, &extension) do
17
+ if options[:through] && !with_deleted
18
+ reflection = reflect_on_association(association_id)
19
+ collection_reader_method(reflection, Caboose::Acts::HasManyThroughWithoutDeletedAssociation)
20
+ collection_accessor_methods(reflection, Caboose::Acts::HasManyThroughWithoutDeletedAssociation, false)
21
+ end
22
+ end
23
+ end
24
+
25
+ alias_method_chain :belongs_to, :deleted
26
+ alias_method :has_many_with_deleted, :has_many
27
+ alias_method :has_many, :has_many_without_deleted
28
+ alias_method :exists_with_deleted?, :exists?
29
+ end
30
+ ActiveRecord::Base.send :include, Caboose::Acts::Paranoid
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pager-acts_as_paranoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.20080506
4
+ version: 1.0.20080507
5
5
  platform: ruby
6
6
  authors:
7
7
  - technoweenie
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-06 00:00:00 -07:00
12
+ date: 2008-05-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,7 +30,6 @@ files:
30
30
  - lib/caboose/acts/belongs_to_with_deleted_association.rb
31
31
  - lib/caboose/acts/has_many_through_without_deleted_association.rb
32
32
  - lib/caboose/acts/paranoid.rb
33
- - lib/pager-acts_as_paranoid.rb
34
33
  - MIT-LICENSE
35
34
  - rails/init.rb
36
35
  - README
@@ -1,34 +0,0 @@
1
- require 'caboose/acts/paranoid'
2
- require 'caboose/acts/belongs_to_with_deleted_association'
3
- require 'caboose/acts/has_many_through_without_deleted_association'
4
-
5
- class << ActiveRecord::Base
6
- def belongs_to_with_deleted(association_id, options = {})
7
- with_deleted = options.delete :with_deleted
8
- returning belongs_to_without_deleted(association_id, options) do
9
- if with_deleted
10
- reflection = reflect_on_association(association_id)
11
- association_accessor_methods(reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
12
- association_constructor_method(:build, reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
13
- association_constructor_method(:create, reflection, Caboose::Acts::BelongsToWithDeletedAssociation)
14
- end
15
- end
16
- end
17
-
18
- def has_many_without_deleted(association_id, options = {}, &extension)
19
- with_deleted = options.delete :with_deleted
20
- returning has_many_with_deleted(association_id, options, &extension) do
21
- if options[:through] && !with_deleted
22
- reflection = reflect_on_association(association_id)
23
- collection_reader_method(reflection, Caboose::Acts::HasManyThroughWithoutDeletedAssociation)
24
- collection_accessor_methods(reflection, Caboose::Acts::HasManyThroughWithoutDeletedAssociation, false)
25
- end
26
- end
27
- end
28
-
29
- alias_method_chain :belongs_to, :deleted
30
- alias_method :has_many_with_deleted, :has_many
31
- alias_method :has_many, :has_many_without_deleted
32
- alias_method :exists_with_deleted?, :exists?
33
- end
34
- ActiveRecord::Base.send :include, Caboose::Acts::Paranoid