closure_tree 3.6.5 → 3.6.6

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/README.md CHANGED
@@ -361,9 +361,14 @@ Closure tree is [tested under every combination](http://travis-ci.org/#!/mceache
361
361
 
362
362
  ## Change log
363
363
 
364
+ ### 3.6.6
365
+
366
+ * Added support for Rails 4's [strong parameter](https://github.com/rails/strong_parameters).
367
+ Thanks, [James Miller](https://github.com/bensie)!
368
+
364
369
  ### 3.6.5
365
370
 
366
- * Use ```quote_table_name``` instead of ```quote_column_name```
371
+ * Use ```quote_table_name``` instead of ```quote_column_name```. Addresses
367
372
  [issue 29](https://github.com/mceachen/closure_tree/issues/29). Thanks,
368
373
  [Marcello Barnaba](https://github.com/vjt)!
369
374
 
@@ -50,7 +50,9 @@ module ClosureTree
50
50
  :class_name => ct_class.to_s,
51
51
  :foreign_key => parent_column_name
52
52
 
53
- attr_accessible :parent
53
+ unless defined?(ActiveModel::ForbiddenAttributesProtection) && ancestors.include?(ActiveModel::ForbiddenAttributesProtection)
54
+ attr_accessible :parent
55
+ end
54
56
 
55
57
  has_many :children, with_order_option(
56
58
  :class_name => ct_class.to_s,
@@ -1,3 +1,3 @@
1
1
  module ClosureTree
2
- VERSION = "3.6.5" unless defined?(::ClosureTree::VERSION)
2
+ VERSION = "3.6.6" unless defined?(::ClosureTree::VERSION)
3
3
  end
data/spec/tag_spec.rb CHANGED
@@ -384,15 +384,35 @@ shared_examples_for Tag do
384
384
  end
385
385
 
386
386
  describe Tag do
387
+ it "should not include ActiveModel::ForbiddenAttributesProtection" do
388
+ if defined?(ActiveModel::ForbiddenAttributesProtection)
389
+ Tag.ancestors.should_not include(ActiveModel::ForbiddenAttributesProtection)
390
+ end
391
+ end
387
392
  it_behaves_like Tag
388
393
  end
389
394
 
390
395
  describe "Tag with AR whitelisted attributes enabled" do
391
396
  before(:all) do
392
397
  ActiveRecord::Base.attr_accessible(nil) # turn on whitelisted attributes
393
- ActiveRecord::Base.descendants.each{|ea|ea.reset_column_information}
398
+ ActiveRecord::Base.descendants.each { |ea| ea.reset_column_information }
399
+ end
400
+ it "should not include ActiveModel::ForbiddenAttributesProtection" do
401
+ if defined?(ActiveModel::ForbiddenAttributesProtection)
402
+ Tag.ancestors.should_not include(ActiveModel::ForbiddenAttributesProtection)
403
+ end
394
404
  end
395
405
  it_behaves_like Tag
396
406
  end
397
407
 
408
+ # This has to be the last one, because we include strong parameters into Tag
409
+ describe "Tag with strong parameters" do
410
+ before(:all) do
411
+ require 'strong_parameters'
412
+ class Tag
413
+ include ActiveModel::ForbiddenAttributesProtection
414
+ end
415
+ end
416
+ it_behaves_like Tag
417
+ end
398
418
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: closure_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.5
4
+ version: 3.6.6
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: 2012-12-01 00:00:00.000000000 Z
12
+ date: 2012-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -155,6 +155,22 @@ dependencies:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: strong_parameters
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
158
174
  description: Easily and efficiently make your ActiveRecord model support hierarchies
159
175
  email:
160
176
  - matthew-github@mceachen.org
@@ -192,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
208
  version: '0'
193
209
  segments:
194
210
  - 0
195
- hash: 2279521455981476723
211
+ hash: 2617295587215713218
196
212
  required_rubygems_version: !ruby/object:Gem::Requirement
197
213
  none: false
198
214
  requirements:
@@ -201,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
217
  version: '0'
202
218
  segments:
203
219
  - 0
204
- hash: 2279521455981476723
220
+ hash: 2617295587215713218
205
221
  requirements: []
206
222
  rubyforge_project:
207
223
  rubygems_version: 1.8.23