is_paranoid_ext 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ .DS_Store
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Alex Neill
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1 @@
1
+ Quick and dirty hack for is_paranoid has_many and has_one associations
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'is_paranoid_ext'
@@ -0,0 +1,36 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{is_paranoid_ext}
3
+ s.version = "0.0.1"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Alex Neill"]
7
+ s.date = %q{2010-05-06}
8
+ s.description = %q{}
9
+ s.email = %q{alex@featureless.co.uk}
10
+ s.extra_rdoc_files = [
11
+ "README.textile"
12
+ ]
13
+ s.files = [
14
+ ".gitignore",
15
+ "MIT-LICENSE",
16
+ "README.textile",
17
+ "init.rb",
18
+ "is_paranoid_ext.gemspec",
19
+ "lib/is_paranoid_ext.rb"
20
+ ]
21
+ s.homepage = %q{http://github.com/ajn/is_paranoid_ext/}
22
+ s.rdoc_options = ["--charset=UTF-8"]
23
+ s.require_paths = ["lib"]
24
+ s.rubygems_version = %q{1.3.5}
25
+ s.summary = %q{HACK}
26
+
27
+ if s.respond_to? :specification_version then
28
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
29
+ s.specification_version = 3
30
+
31
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
32
+ else
33
+ end
34
+ else
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ require 'activerecord'
2
+
3
+ module IsParanoidExt
4
+
5
+ def has_many_paranoid(association_id, options = {}, &extension)
6
+ merge_paranoid_options!(association_id, options)
7
+ has_many association_id, options, &extension
8
+ end
9
+
10
+ def has_one_paranoid(association_id, options = {}, &extension)
11
+ merge_paranoid_options!(association_id, options)
12
+ has_one association_id, options, &extension
13
+ end
14
+
15
+ private
16
+
17
+ def merge_paranoid_options!(association_id, options)
18
+ if (klass = association_id.to_s.classify.constantize) && klass.respond_to?(:restore)
19
+ options.merge!(:conditions => ["#{klass.quoted_table_name}.#{klass.destroyed_field} IS ?", klass.field_not_destroyed])
20
+ end
21
+ end
22
+ end
23
+
24
+ ActiveRecord::Base.send(:extend, IsParanoidExt)
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: is_paranoid_ext
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Alex Neill
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-06 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: ""
22
+ email: alex@featureless.co.uk
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.textile
29
+ files:
30
+ - .gitignore
31
+ - MIT-LICENSE
32
+ - README.textile
33
+ - init.rb
34
+ - is_paranoid_ext.gemspec
35
+ - lib/is_paranoid_ext.rb
36
+ has_rdoc: true
37
+ homepage: http://github.com/ajn/is_paranoid_ext/
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options:
42
+ - --charset=UTF-8
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ segments:
50
+ - 0
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.3.6
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: HACK
66
+ test_files: []
67
+