more robust pool ordering

This commit is contained in:
albert
2011-10-15 16:58:36 -04:00
parent e7b8daba98
commit 5f9e56b88c
3 changed files with 23 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ class Pool < ActiveRecord::Base
before_validation :normalize_post_ids
before_validation :initialize_creator, :on => :create
after_save :create_version
attr_accessible :name, :description, :post_ids, :is_active, :post_count
attr_accessible :name, :description, :post_ids, :post_id_array, :is_active, :post_count
def self.name_to_id(name)
if name =~ /^\d+$/
@@ -123,6 +123,11 @@ class Pool < ActiveRecord::Base
@post_id_array ||= post_ids.scan(/\d+/).map(&:to_i)
end
def post_id_array=(array)
self.post_ids = array.join(" ")
clear_post_id_array
end
def post_id_array_was
@post_id_array_was ||= post_ids_was.scan(/\d+/).map(&:to_i)
end