acts_as_orderable 0.1.2 → 0.1.3

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/CHANGELOG.rdoc CHANGED
@@ -3,4 +3,6 @@
3
3
  = Version 0.1.1
4
4
  * table_exists? fix
5
5
  = Version 0.1.2
6
- * Fix for assigning same parent - should not change order
6
+ * Fix for assigning same parent - should not change order
7
+ = Version 0.1.3
8
+ * Fix for casting string to int on parent comparing
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('acts_as_orderable', '0.1.2') do |p|
6
+ Echoe.new('acts_as_orderable', '0.1.3') do |p|
7
7
  p.description = "Rails gem allowing ActiveRecord models to have order and to move them up and down"
8
8
  p.url = "https://github.com/mensfeld/Acts-as-Orderable"
9
9
  p.author = "Maciej Mensfeld"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{acts_as_orderable}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Maciej Mensfeld}]
9
- s.date = %q{2011-12-08}
9
+ s.date = %q{2011-12-11}
10
10
  s.description = %q{Rails gem allowing ActiveRecord models to have order and to move them up and down}
11
11
  s.email = %q{maciej@mensfeld.pl}
12
12
  s.extra_rdoc_files = [%q{CHANGELOG.rdoc}, %q{README.md}, %q{lib/acts_as_orderable.rb}]
@@ -39,7 +39,7 @@ module Acts
39
39
  old_parent = self.send(:"#{parent_column}")
40
40
  super new_parent
41
41
  # If object exist (been saved and we're just changing its parent)
42
- init_me! unless self.new_record? || old_parent == new_parent
42
+ init_me! unless self.new_record? || old_parent.to_i == new_parent.to_i
43
43
  end if parent_column
44
44
  end
45
45
  end
@@ -327,6 +327,27 @@ describe WayCoolerElement do
327
327
  aa.element_order.should == olda
328
328
  ab.element_order.should == oldb
329
329
  end
330
+
331
+ context "and we send it as a string not as an integer" do
332
+ it "should not interfere with children order" do
333
+ a = subject.create
334
+ aa = a.children.create
335
+ ab = a.children.create
336
+ a.reload; aa.reload; ab.reload
337
+
338
+ olda = aa.element_order
339
+ oldb = ab.element_order
340
+
341
+ aa.update_attributes({:parent_id => "#{aa.parent_id}"})
342
+ aa.reload
343
+ ab.reload
344
+ aa.element_order.should == olda
345
+ ab.element_order.should == oldb
346
+ end
347
+ end
348
+
330
349
  end
331
350
 
351
+
352
+
332
353
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_orderable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-08 00:00:00.000000000Z
12
+ date: 2011-12-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &10839320 !ruby/object:Gem::Requirement
16
+ requirement: &13061300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *10839320
24
+ version_requirements: *13061300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: active_record
27
- requirement: &10838660 !ruby/object:Gem::Requirement
27
+ requirement: &13060580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *10838660
35
+ version_requirements: *13060580
36
36
  description: Rails gem allowing ActiveRecord models to have order and to move them
37
37
  up and down
38
38
  email: maciej@mensfeld.pl