lib/bait/simple_query.rb in bait-0.3.2 vs lib/bait/simple_query.rb in bait-0.4.0
- old
+ new
@@ -8,15 +8,20 @@
end
base.after_destroy do
self.class.ids = self.class.ids.reject{|id| id == self.id}
end
end
+
+ def id_list_key
+ "#{self.name.split('::').last.downcase}_ids"
+ end
+
def ids
- Bait.store.raw["build_ids"] ||= []
+ Bait.store.raw[id_list_key] ||= []
end
def ids=(new_ids)
- Bait.store.raw["build_ids"] = new_ids
+ Bait.store.raw[id_list_key] = new_ids
end
def all
ids.map{|id| self.read(id)}
end