simple_nested_set 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,9 +6,9 @@ module SimpleNestedSet
6
6
  @_nested_set ||= nested_set_class.new(self)
7
7
  end
8
8
 
9
- def attributes=(attributes)
9
+ def attributes=(attributes, *args)
10
10
  @_nested_set_attributes = nested_set_class.extract_attributes!(attributes)
11
- super(attributes)
11
+ super(attributes, *args)
12
12
  end
13
13
 
14
14
  # recursively populates the parent and children associations of self and
@@ -20,7 +20,7 @@ module SimpleNestedSet
20
20
  node.move_to_right_of(left_id)
21
21
  elsif right_id && right_id != node.id
22
22
  node.move_to_left_of(right_id)
23
- elsif parent_id != node.parent_id
23
+ elsif parent_id && parent_id != node.parent_id
24
24
  node.move_to_child_of(parent_id)
25
25
  end
26
26
  end
@@ -44,7 +44,7 @@ module SimpleNestedSet
44
44
  end
45
45
 
46
46
  def normalize_attributes!
47
- attributes.symbolize_keys!
47
+ attributes.symbolize_keys! if attributes.respond_to?(:symbolize_keys!)
48
48
  attributes.each { |key, value| attributes[key] = nil if value == 'null' }
49
49
 
50
50
  [:parent, :left, :right].each do |key|
@@ -25,7 +25,7 @@ module SimpleNestedSet
25
25
  def extract_attributes!(attributes)
26
26
  attributes.slice(*SimpleNestedSet::ATTRIBUTES).tap do
27
27
  attributes.except!(*(SimpleNestedSet::ATTRIBUTES - [:path]))
28
- end
28
+ end if attributes.respond_to?(:slice)
29
29
  end
30
30
  end
31
31
 
@@ -1,3 +1,3 @@
1
1
  module SimpleNestedSet
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_nested_set
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-21 00:00:00 +02:00
18
+ date: 2010-08-29 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency