Files
danbooru/app/models/pool_version.rb
2011-04-01 19:01:17 -04:00

17 lines
394 B
Ruby

class PoolVersion < ActiveRecord::Base
class Error < Exception ; end
validates_presence_of :updater_id, :updater_ip_addr
belongs_to :pool
before_validation :initialize_updater
def initialize_updater
self.updater_id = CurrentUser.id
self.updater_ip_addr = CurrentUser.ip_addr
end
def post_id_array
@post_id_array ||= post_ids.scan(/\d+/).map(&:to_i)
end
end