app/models/suggested_household.rb in artfully_ose-1.2.0 vs app/models/suggested_household.rb in artfully_ose-1.3.0.pre1
- old
+ new
@@ -1,8 +1,10 @@
class SuggestedHousehold < ActiveRecord::Base
- attr_accessible :ids, :ignored
+ attr_accessible :ids, :ignored, :organization_id
+ belongs_to :organization
+
def self.with_people(people)
ids = people.map(&:id).sort.join(',')
where(:ids => ids).first
end
@@ -12,13 +14,17 @@
end
def self.find_or_create_with_people(people)
ids = people.map(&:id).sort.join(',')
matches = where(:ids => ids)
- matches.first ? matches.first : SuggestedHousehold.create_with_people(people)
+ matches.first ? matches.first : create_with_people(people)
end
def individuals
Individual.where(:id => ids.split(','))
+ end
+
+ def ignore!
+ update_attributes(:ignored => true)
end
end