Class: Validator::ImageForum

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/type_cartographer/archive/image_forum.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/type_cartographer/archive/image_forum.rb', line 3

def validate(record)
	if !record.imageable_type.nil?
		if record.imageable_type == "Venture::Forum"
			if !record.imageable_id.nil?
				if !::Venture::Forum.exists?(record.imageable_id)
					record.errors[:forum] = "forum_id does not map to a forum in the database"
				end
			end
		end
	end
end