better querying

This commit is contained in:
ilya 2010-10-19 19:16:44 -07:00
parent e3ffd2ffe7
commit 38e8af2300
2 changed files with 8 additions and 15 deletions

View file

@ -97,7 +97,6 @@ GEM
activesupport (= 3.0.1)
activesupport (3.0.1)
addressable (2.2.2)
archive-tar-minitar (0.5.2)
arel (1.0.1)
activesupport (~> 3.0.0)
aws (2.3.21)
@ -164,8 +163,7 @@ GEM
i18n (0.4.1)
json (1.4.6)
json_pure (1.4.6)
linecache19 (0.5.11)
ruby_core_source (>= 0.1.4)
linecache (0.43)
mail (2.2.7)
activesupport (>= 2.3.6)
mime-types
@ -227,16 +225,11 @@ GEM
rspec-expectations (= 2.0.0)
rspec-rails (2.0.0)
rspec (= 2.0.0)
ruby-debug-base19 (0.11.24)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby_core_source (>= 0.1.4)
ruby-debug19 (0.11.6)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
ruby-debug-base (0.10.3)
linecache (>= 0.3)
rubyzip (0.9.4)
selenium-webdriver (0.0.29)
childprocess (>= 0.0.7)
@ -294,7 +287,7 @@ DEPENDENCIES
roxml!
rspec (>= 2.0.0)
rspec-rails (>= 2.0.0)
ruby-debug19
ruby-debug
sprinkle!
thin
webmock

View file

@ -129,7 +129,7 @@ class User
def delete_person_from_aspect(person_id, aspect_id)
raise "Can not delete a person from an aspect you do not own" unless aspect = self.aspects.find_by_id(aspect_id)
aspect.person_ids.delete(person_id)
id_array = aspect.posts.find_all_by_person_id(person_id).collect{|x| x.id}
id_array = aspect.posts.all(:person_id => person_id, :select => "_id").collect{|x| x.id}
aspect.post_ids = aspect.post_ids - id_array
aspect.save
end