Permalink
Browse files

Made find_association_ids private

  • Loading branch information...
1 parent b73c70c commit 158b916df79f0f942151340add98227e968e30e9 @joeljunstrom joeljunstrom committed Mar 3, 2012
Showing with 17 additions and 17 deletions.
  1. +16 −16 app/models/item.rb
  2. +1 −1 test/unit/item_test.rb
View
@@ -102,21 +102,6 @@ def has_url?
published? and node.present?
end
- def find_association_ids(source = nil)
- collection = source || self.data
- result = []
-
- collection.find_all { |d| d.active? }.each do |d|
- if d.respond_to?(:page_id)
- result << d.page_id
- elsif d.respond_to?(:data) && d.data.any?
- result += find_association_ids(d.data)
- end
- end
-
- result.compact.uniq
- end
-
private
def sort_data
@@ -140,5 +125,20 @@ def touch_associations
:association_ids => self.id
}, :'$set' => { :updated_at => self.updated_at.utc })
end
-
+
+ def find_association_ids(source = nil)
+ collection = source || self.data
+ result = []
+
+ collection.find_all { |d| d.active? }.each do |d|
+ if d.respond_to?(:page_id)
+ result << d.page_id
+ elsif d.respond_to?(:data) && d.data.any?
+ result += find_association_ids(d.data)
+ end
+ end
+
+ result.compact.uniq
+ end
+
end
@@ -40,7 +40,7 @@ class ItemTest < ActiveSupport::TestCase
PageAssociation.new(:page_id => 4, :active => true)
]
- assert_equal [1, 2, 4], @item.find_association_ids
+ assert_equal [1, 2, 4], @item.send(:find_association_ids)
end
context 'with associations to other items' do

0 comments on commit 158b916

Please sign in to comment.