This commit is contained in:
r888888888
2014-08-25 16:41:27 -07:00
parent 3c4119663e
commit 267df896c6
9 changed files with 95 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ require 'ostruct'
class Pool < ActiveRecord::Base
validates_uniqueness_of :name, :case_sensitive => false
validates_format_of :name, :with => /\A[^\s,]+\Z/, :message => "cannot have whitespace or commas"
validates_format_of :name, :with => /\A[^,]+\Z/, :message => "cannot have commas"
validates_inclusion_of :category, :in => %w(series collection)
belongs_to :creator, :class_name => "User"
belongs_to :updater, :class_name => "User"
@@ -316,6 +316,10 @@ class Pool < ActiveRecord::Base
end
end
def cover_post_id
post_ids[/^(\d+)/, 1]
end
def create_version(force = false)
if post_ids_changed? || name_changed? || description_changed? || is_active_changed? || is_deleted_changed? || category_changed? || force
last_version = versions.last