protected_parent 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.1"
12
+ gem "rcov", ">= 0"
13
+ gem "rspec"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.5.1)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rake (0.8.7)
11
+ rcov (0.9.9)
12
+ rspec (2.3.0)
13
+ rspec-core (~> 2.3.0)
14
+ rspec-expectations (~> 2.3.0)
15
+ rspec-mocks (~> 2.3.0)
16
+ rspec-core (2.3.1)
17
+ rspec-expectations (2.3.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.3.0)
20
+ shoulda (2.11.3)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bundler (~> 1.0.0)
27
+ jeweler (~> 1.5.1)
28
+ rcov
29
+ rspec
30
+ shoulda
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ protected_parent_of
2
+ ==============
3
+
4
+ Stops the deletion of an ActiveRecord object when members of a specified child association exist.
5
+
6
+ It adds a "removeable?" method to evaluate whether the object may be deleted and the necessary before_destroy callback.
7
+
8
+ Example Usage
9
+ =============
10
+
11
+ Adding to your models
12
+ ---------------------
13
+
14
+ The model 'has_many :posts'. Do not allow deletion if there are Post records associated with this object:
15
+
16
+ class Category < ActiveRecord::Base
17
+ protected_parent_of :posts
18
+ end
19
+
20
+ If it 'has_one :attachement', don't allow deletion until the attachment has been removed. Use the singular, just like the 'has_one'
21
+
22
+ class Category < ActiveRecord::Base
23
+ protected_parent_of :attachment
24
+ end
25
+
26
+ If necessary, allow several child objects to stay deletion. For example, a polymorphic category model may have:
27
+
28
+ class Category < ActiveRecord::Base
29
+ protected_parent_of :posts, :comments
30
+ end
31
+
32
+ Depending on taste, you can call protected_parent_of multiple times:
33
+
34
+ class Category < ActiveRecord::Base
35
+ has_many :posts
36
+ has_many :comments
37
+ protected_parent_of :posts, :comments
38
+
39
+ has_one :attachment
40
+ protected_parent_of :attachment
41
+ end
42
+
43
+ When you need something more sophisticated, you can target a method or named_scope. This would block deletion of the category if there were any active posts:
44
+
45
+ class Category < ActiveRecord::Base
46
+ has_many :posts
47
+ protected_parent_of :active_posts
48
+
49
+ def active_posts
50
+ posts.active
51
+ end
52
+ end
53
+
54
+ class Post < ActiveRecord::Base
55
+ named_scope :active, :condition => { :active => true }
56
+ end
57
+
58
+ Using the methods
59
+ -----------------
60
+
61
+ Once applied to a model, protected_parent_of adds several methods to your model. You can now use 'protected?' and 'removable?'
62
+
63
+ category = Category.new
64
+ category.protected? # False
65
+ category.removable? # True
66
+
67
+ category = Category.new
68
+ category.posts << Post.create
69
+ category.protected? # True
70
+ category.removable? # False
71
+
72
+ And most importantly, it will block deletion
73
+
74
+ category = Category.create
75
+ category.posts = Post.create
76
+ category.delete # False
77
+ category.delete! # Raises an exception
78
+
79
+ License
80
+ =======
81
+ Copyright (c) 2010 Tim Harvey, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,62 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "protected_parent"
16
+ gem.homepage = "http://github.com/openteam/protected_parent"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{Protect a parent record from deletion when it has specified child records}
19
+ gem.description = %Q{Stops the deletion of an ActiveRecord object when members of a specified child association exist.}
20
+ gem.email = "lda@openteam.ru"
21
+ gem.authors = ["Tim Harvey", "Dmitry Lihachev"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ end
42
+
43
+ #require 'spec/rake/spectask'
44
+
45
+ #desc 'Default: run specs.'
46
+ #task :default => :spec
47
+
48
+ #desc 'Run the specs'
49
+ #Spec::Rake::SpecTask.new(:spec) do |t|
50
+ # t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
51
+ # t.spec_files = FileList['spec/**/*_spec.rb']
52
+ #end
53
+
54
+ require 'rake/rdoctask'
55
+ Rake::RDocTask.new do |rdoc|
56
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
57
+
58
+ rdoc.rdoc_dir = 'rdoc'
59
+ rdoc.title = "protected_parent #{version}"
60
+ rdoc.rdoc_files.include('README*')
61
+ rdoc.rdoc_files.include('lib/**/*.rb')
62
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,58 @@
1
+ #encoding: utf-8
2
+ module ProtectedParent
3
+ def self.included(base)
4
+ base.send :extend, ClassMethods
5
+ base.send :include, InstanceMethods
6
+ end
7
+
8
+ module ClassMethods
9
+
10
+ def protected_parent_of(*children_names)
11
+
12
+ @softly_protected = children_names.extract_options!.delete(:protects) == :softly
13
+
14
+ children_names.each do |child_name|
15
+ self.children_of_protected_parent << child_name.to_s
16
+ end
17
+
18
+ before_destroy :removable?
19
+ end
20
+
21
+ def children_of_protected_parent
22
+ @children_of_protected_parent ||= []
23
+ end
24
+
25
+ def softly_protected
26
+ @softly_protected
27
+ end
28
+
29
+ end
30
+
31
+ module InstanceMethods
32
+ # Can the instance be deleted?
33
+ def removable?
34
+ self.class.softly_protected || protected_children.empty?
35
+ end
36
+
37
+ def protected_children
38
+ self.class.children_of_protected_parent.select do |child|
39
+ if a_plural child
40
+ child unless send(child).count.zero?
41
+ else
42
+ child unless send(child).nil?
43
+ end
44
+ end
45
+ end
46
+
47
+ # The inverse of removable?, is this instance protected from deletion?
48
+ def protected?
49
+ !removable?
50
+ end
51
+
52
+ def a_plural(child)
53
+ child.pluralize == child
54
+ end
55
+ end
56
+ end
57
+
58
+ ActiveRecord::Base.send :include, ProtectedParent
@@ -0,0 +1 @@
1
+ require 'protected_parent/protected_parent_of'
@@ -0,0 +1,82 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{protected_parent}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tim Harvey", "Dmitry Lihachev"]
12
+ s.date = %q{2010-12-18}
13
+ s.description = %q{Stops the deletion of an ActiveRecord object when members of a specified child association exist.}
14
+ s.email = %q{lda@openteam.ru}
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "MIT-LICENSE",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/protected_parent.rb",
27
+ "lib/protected_parent/protected_parent_of.rb",
28
+ "protected_parent.gemspec",
29
+ "spec/db/database.yml",
30
+ "spec/db/schema.rb",
31
+ "spec/models/attachment.rb",
32
+ "spec/models/category.rb",
33
+ "spec/models/comment.rb",
34
+ "spec/models/post.rb",
35
+ "spec/protected_parent_spec.rb",
36
+ "spec/spec.opts",
37
+ "spec/spec_helper.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/openteam/protected_parent}
40
+ s.licenses = ["MIT"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.3.7}
43
+ s.summary = %q{Protect a parent record from deletion when it has specified child records}
44
+ s.test_files = [
45
+ "spec/db/schema.rb",
46
+ "spec/models/attachment.rb",
47
+ "spec/models/category.rb",
48
+ "spec/models/comment.rb",
49
+ "spec/models/post.rb",
50
+ "spec/protected_parent_spec.rb",
51
+ "spec/spec_helper.rb"
52
+ ]
53
+
54
+ if s.respond_to? :specification_version then
55
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
+ s.specification_version = 3
57
+
58
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
60
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
61
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
62
+ s.add_development_dependency(%q<rcov>, [">= 0"])
63
+ s.add_development_dependency(%q<rspec>, [">= 0"])
64
+ s.add_development_dependency(%q<rspec>, ["> 1.2.3"])
65
+ else
66
+ s.add_dependency(%q<shoulda>, [">= 0"])
67
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
68
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
69
+ s.add_dependency(%q<rcov>, [">= 0"])
70
+ s.add_dependency(%q<rspec>, [">= 0"])
71
+ s.add_dependency(%q<rspec>, ["> 1.2.3"])
72
+ end
73
+ else
74
+ s.add_dependency(%q<shoulda>, [">= 0"])
75
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
76
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
77
+ s.add_dependency(%q<rcov>, [">= 0"])
78
+ s.add_dependency(%q<rspec>, [">= 0"])
79
+ s.add_dependency(%q<rspec>, ["> 1.2.3"])
80
+ end
81
+ end
82
+
@@ -0,0 +1,3 @@
1
+ sqlite3:
2
+ :adapter: sqlite3
3
+ :database: vendor/plugins/protected_parent/spec/db/protected_parent.sqlite3.db
data/spec/db/schema.rb ADDED
@@ -0,0 +1,17 @@
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+ create_table :categories, :force => true do |t|
3
+ t.column :name, :string
4
+ end
5
+
6
+ create_table :posts, :force => true do |t|
7
+ t.column :category_id, :integer
8
+ end
9
+
10
+ create_table :comments, :force => true do |t|
11
+ t.column :category_id, :integer
12
+ end
13
+
14
+ create_table :attachments, :force => true do |t|
15
+ t.column :category_id, :integer
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ class Attachment < ActiveRecord::Base
2
+ belongs_to :category
3
+ end
@@ -0,0 +1,8 @@
1
+ class Category < ActiveRecord::Base
2
+ has_many :posts
3
+ has_many :comments
4
+ protected_parent_of :posts, :comments
5
+
6
+ has_one :attachment
7
+ protected_parent_of :attachment
8
+ end
@@ -0,0 +1,3 @@
1
+ class Comment < ActiveRecord::Base
2
+ belongs_to :category
3
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ActiveRecord::Base
2
+ belongs_to :category
3
+ end
@@ -0,0 +1,68 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "ProtectedParent" do
4
+ describe "with an instance that does not have associated records" do
5
+ it "should allow a destroy" do
6
+ category = Category.create
7
+ lambda { category.destroy }.should change{ Category.count }
8
+ end
9
+ end
10
+
11
+ describe "with an instance that has associated records" do
12
+ it "should block the destroy" do
13
+ category = Category.create
14
+ category.posts << Post.new
15
+ category.save!
16
+ lambda { category.destroy }.should_not change{ Category.count }
17
+ end
18
+ end
19
+
20
+ describe "removable? method" do
21
+ it "should return true when there are no children for the instance" do
22
+ category = Category.create
23
+ category.removable?.should == true
24
+ end
25
+
26
+ it "should be false when the instance has only the firs of the two defined child record types" do
27
+ category = Category.create
28
+ category.posts << Post.new
29
+ category.removable?.should == false
30
+ end
31
+
32
+ it "should be false when the instance has only the firs of the two defined child record types" do
33
+ category = Category.create
34
+ category.comments << Comment.new
35
+ category.removable?.should == false
36
+ end
37
+
38
+ it "should be false when the instance has both of the two defined child record types" do
39
+ category = Category.create
40
+ category.posts << Post.new
41
+ category.comments << Comment.new
42
+ category.removable?.should == false
43
+ end
44
+ end
45
+
46
+ describe "protected? method" do
47
+ it "should return the opposite of removable?" do
48
+ category = Category.create
49
+ category.removable?.should == !category.protected?
50
+
51
+ category = Category.create
52
+ category.posts << Post.new
53
+ category.removable?.should == !category.protected?
54
+ end
55
+ end
56
+ describe "has an instance with a single 'has_one' child" do
57
+ it "should allow delete if the instance doesn't have a child assigned" do
58
+ category = Category.create
59
+ lambda { category.destroy }.should change{ Category.count }
60
+ end
61
+
62
+ it "should block the delete if the instance has a child assigned" do
63
+ category = Category.create
64
+ category.attachment = Attachment.new
65
+ lambda { category.destroy }.should_not change{ Category.count }
66
+ end
67
+ end
68
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,5 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
5
+ --drb
@@ -0,0 +1,20 @@
1
+ begin
2
+ require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
3
+ rescue LoadError
4
+ puts "You need to install rspec in your base app"
5
+ exit
6
+ end
7
+
8
+ plugin_spec_dir = File.dirname(__FILE__)
9
+
10
+ # Load up the dummy db with the schema used by the dummy models
11
+ ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
12
+ databases = YAML::load(IO.read(plugin_spec_dir + "/db/database.yml"))
13
+ ActiveRecord::Base.establish_connection(databases[ENV["DB"] || "sqlite3"])
14
+ load(File.join(plugin_spec_dir, "db", "schema.rb"))
15
+
16
+ # Load the dummy models used in testing
17
+ path = File.join(plugin_spec_dir, "models")
18
+ $LOAD_PATH << File.join(plugin_spec_dir, "models")
19
+ ActiveSupport::Dependencies.load_paths << path
20
+ ActiveSupport::Dependencies.load_once_paths.delete(path)
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: protected_parent
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Tim Harvey
13
+ - Dmitry Lihachev
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-18 00:00:00 +06:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: shoulda
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ prerelease: false
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 0
45
+ version: 1.0.0
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: jeweler
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 1
58
+ - 5
59
+ - 1
60
+ version: 1.5.1
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rcov
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: rspec
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: *id005
90
+ - !ruby/object:Gem::Dependency
91
+ name: rspec
92
+ requirement: &id006 !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ">"
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 1
99
+ - 2
100
+ - 3
101
+ version: 1.2.3
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: *id006
105
+ description: Stops the deletion of an ActiveRecord object when members of a specified child association exist.
106
+ email: lda@openteam.ru
107
+ executables: []
108
+
109
+ extensions: []
110
+
111
+ extra_rdoc_files:
112
+ - README.md
113
+ files:
114
+ - .document
115
+ - Gemfile
116
+ - Gemfile.lock
117
+ - MIT-LICENSE
118
+ - README.md
119
+ - Rakefile
120
+ - VERSION
121
+ - lib/protected_parent.rb
122
+ - lib/protected_parent/protected_parent_of.rb
123
+ - protected_parent.gemspec
124
+ - spec/db/database.yml
125
+ - spec/db/schema.rb
126
+ - spec/models/attachment.rb
127
+ - spec/models/category.rb
128
+ - spec/models/comment.rb
129
+ - spec/models/post.rb
130
+ - spec/protected_parent_spec.rb
131
+ - spec/spec.opts
132
+ - spec/spec_helper.rb
133
+ has_rdoc: true
134
+ homepage: http://github.com/openteam/protected_parent
135
+ licenses:
136
+ - MIT
137
+ post_install_message:
138
+ rdoc_options: []
139
+
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ hash: -948303156927737748
148
+ segments:
149
+ - 0
150
+ version: "0"
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ segments:
157
+ - 0
158
+ version: "0"
159
+ requirements: []
160
+
161
+ rubyforge_project:
162
+ rubygems_version: 1.3.7
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: Protect a parent record from deletion when it has specified child records
166
+ test_files:
167
+ - spec/db/schema.rb
168
+ - spec/models/attachment.rb
169
+ - spec/models/category.rb
170
+ - spec/models/comment.rb
171
+ - spec/models/post.rb
172
+ - spec/protected_parent_spec.rb
173
+ - spec/spec_helper.rb